same tick - sevral (unexpected) event results  [SOLVED]

Questions about MultiCharts and user contributed studies.
Ram
Posts: 90
Joined: 25 Nov 2014
Has thanked: 17 times
Been thanked: 5 times

same tick - sevral (unexpected) event results

Postby Ram » 26 Nov 2014

Hi all,

Newbie need your help with some basic understanding which I don't have :)

I have the following study script:

Code: Select all

inputs:
Price( Close ),
Length_2D( 2 ),
Length_3D( 3 ),
Length_5D( 5 ),
OverSold( 20 ),
OverBought( 80 ),
OverSColor( Cyan ),
OverBColor( Red ) ;

variables: var2D( 0 ), var3D( 0 ) , var5D( 0 ), BollingerBand_High(0), BollingerBand_Low(0);

var2D = RSI( Price, Length_2D ) ;
var3D = RSI( Price, Length_3D ) ;
var5D = RSI( Price, Length_5D ) ;


BollingerBand_Low = BollingerBand(close, 20, -2) ;
BollingerBand_High = BollingerBand(close, 20, 2) ;
//print( BollingerBand_Low , BollingerBand_High) ;

if var2D > OverBought and var3D > OverBought and var5D > OverBought and close > BollingerBand_High then
Value3 = Text_New(Date, Time, high + 0.08 , "S") ;
if var2D < OverSold and var3D < OverSold and var5D < OverSold and close < BollingerBand_Low then
Value4 = Text_New(Date, Time, low - 0.08 , "B1 " + numtostr(low ,2)) ;
and the results which i don't truly understand why it fires three times:
http://go-ram.s3.amazonaws.com/MultiCha ... B_text.png

Don't know if needed but this is the script properties:
http://go-ram.s3.amazonaws.com/MultiCha ... erties.png

now, if i remark one line of code, for example:

Code: Select all

var2D = RSI( Price, Length_2D ) ;
var3D = RSI( Price, Length_3D ) ;
//var5D = RSI( Price, Length_5D ) ;
now i get it five times:
http://go-ram.s3.amazonaws.com/MultiCha ... B_text.png

Can anyone explain the logic behind this? I was under the impression that each candle fires the script only once..

Thank you all in advance,
Best,
R.

User avatar
Smoky
Posts: 507
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 97 times
Been thanked: 115 times

Re: same tick - sevral (unexpected) event results

Postby Smoky » 26 Nov 2014

if you make this comment line don't forget var5D will be always at zero !



var5D > OverBought never go

var5D < OverSold always true

just in first read ....

Ram
Posts: 90
Joined: 25 Nov 2014
Has thanked: 17 times
Been thanked: 5 times

Re: same tick - sevral (unexpected) event results

Postby Ram » 26 Nov 2014

if you make this comment line don't forget var5D will be always at zero !



var5D > OverBought never go

var5D < OverSold always true

just in first read ....

got it. thx much for that tip!

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: same tick - sevral (unexpected) event results

Postby TJ » 26 Nov 2014

Hi all,
::
Can anyone explain the logic behind this? I was under the impression that each candle fires the script only once..

Thank you all in advance,
Best,
R.
What type of bar are those?
What is the resolution?

If you have bars with H=L, the text object will be drawn on the next bar that is H<>L.

Ram
Posts: 90
Joined: 25 Nov 2014
Has thanked: 17 times
Been thanked: 5 times

Re: same tick - sevral (unexpected) event results

Postby Ram » 26 Nov 2014

Hi TJ,

I'm using Candlestick and 1 second resolution.

Hi all,
::
Can anyone explain the logic behind this? I was under the impression that each candle fires the script only once..

Thank you all in advance,
Best,
R.
What type of bar are those?
What is the resolution?

If you have bars with H=L, the text object will be drawn on the next bar that is H<>L.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: same tick - sevral (unexpected) event results

Postby TJ » 26 Nov 2014

Hi TJ,
I'm using Candlestick and 1 second resolution.
Please post a larger screenshot... with more bars on the left of the text objects.

Ram
Posts: 90
Joined: 25 Nov 2014
Has thanked: 17 times
Been thanked: 5 times

Re: same tick - sevral (unexpected) event results

Postby Ram » 26 Nov 2014

Hi TJ,
I'm using Candlestick and 1 second resolution.
Please post a larger screenshot... with more bars on the left of the text objects.
is this good?
http://go-ram.s3.amazonaws.com/MultiCha ... Screen.png

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: same tick - sevral (unexpected) event results  [SOLVED]

Postby TJ » 26 Nov 2014

Hi TJ,
I'm using Candlestick and 1 second resolution.
Please post a larger screenshot... with more bars on the left of the text objects.
is this good?
Can you see all the empty bars?

The text for those bars will be posted to the next bar.


Try a different resolution... bars with valid data, and bars with H>L.

Ram
Posts: 90
Joined: 25 Nov 2014
Has thanked: 17 times
Been thanked: 5 times

Re: same tick - sevral (unexpected) event results

Postby Ram » 26 Nov 2014

@TJ

Awesome! added High > Low and that indeed fixed this! you rock! :)
many thanks!!

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: same tick - sevral (unexpected) event results

Postby TJ » 26 Nov 2014

@TJ

Awesome! added High > Low and that indeed fixed this! you rock! :)
many thanks!!
YW


Return to “MultiCharts”