True low not returning correct result
Forums › ProRealTime English forum › ProBuilder support › True low not returning correct result
- This topic has 12 replies, 2 voices, and was last updated 6 years ago by Nicolas.
-
-
02/11/2018 at 7:01 PM #62301
Hi,
New to real time pro and coding indicators.
Im coding a true low indicator (example code below) but I find the indicator returns the wrong candle as being the true low. It shows the candle after the real true low candle.
Can anyone review my code please and advise if it’s inaccurate? Thanks
1234567891011121314151617181920212223H0=High[0]C1=Close[1]Truelow0 = Min (H0,C1)H1=High[1]C2=Close[2]Truelow1 = Min(H1,C2)H2=High[2]C3=Close[3]Truelow2 = Min(H2,C3)Result1 = Min(Truelow0, Truelow1)Result2 = Truelow2 < Result1Return Result202/12/2018 at 2:06 PM #6243002/12/2018 at 9:48 PM #62488Hi,
True low of a candle refers to the minimum between the current candle’s low and previous candle’s close.
Above I have gone back 3 candles. I want to return the 3rd previous candle if the true low of this is less than minimum between the true low of the following two candles.
What the code is returning me is the current candle rather than the 3rd previous candle.
Hope that makes sense.
02/14/2018 at 11:47 AM #62714The code is returning a boolean value (=1) when all your conditions are met and on the current candle because the code is read at each new period, it is the normal behavior to me. Sorry if I don’t understand clearly.. but you want the histogram to be plotted 3 bars ago when your indicator has found a positive result?
02/14/2018 at 11:06 PM #62790The code is returning a boolean value (=1) when all your conditions are met and on the current candle because the code is read at each new period, it is the normal behavior to me. Sorry if I don’t understand clearly.. but you want the histogram to be plotted 3 bars ago when your indicator has found a positive result?
Hi Nicolas, yes that is correct, I want the histogram to return the value of 1 on the period/candle which meets the conditions, not the current period/candle. This could be 3 days ago as per my example above or 10 days ago, the time period would be a variable. Can you help with the code for this? Thank you.
02/16/2018 at 8:05 AM #6288003/05/2018 at 9:18 PM #64500Hi Nicolas,
Sorry for the delay in replying; been tied up with something else.
Yes, should be useful also, as I suppose that could be my indicator (e. g. an arrow on the candle where the condition is met, rather than the value of 1; is that what you mean?). Would be great if you could help with this. Thanks
03/07/2018 at 2:20 PM #64673Not tested, but should be ok: (draw a black up arrow below the 3rd previous low when “result2” is true, with count starting on the current candle).
123456789101112131415161718192021222324252627H0=High[0]C1=Close[1]Truelow0 = Min (H0,C1)H1=High[1]C2=Close[2]Truelow1 = Min(H1,C2)H2=High[2]C3=Close[3]Truelow2 = Min(H2,C3)Result1 = Min(Truelow0, Truelow1)Result2 = Truelow2 < Result1if Result2 thendrawarrowup(barindex[2],low[2])endifReturn03/07/2018 at 11:48 PM #64710Thanks for this. I have tried it but it doesn’t seem to be working; it is not drawing any arrows even though I can see where the condition is fulfilled but there are no arrows returned by the code.
Also, my explanation of what is a true low was right but the code I wrote was wrong; should have been the one below.
L0=Low[0]
C1=Close[1]
Truelow0 = Min (L0,C1)
L1=Low[1]
C2=Close[2]
Truelow1 = Min(L1,C2)
L2=Low[2]
C3=Close[3]
Truelow2 = Min(L2,C3)
Result1 = Min(Truelow0, Truelow1)
Result2 = Truelow2 < Result1
if Result2 then
drawarrowup(barindex[2],low[2])
endif
ReturnThanks
03/08/2018 at 8:33 AM #64718> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
I got many arrows on my chart. Please add the indicator on your price with the wrench at the left upper side of your price chart.
03/08/2018 at 10:54 PM #64857That seem to have worked; I normally click on “Add indicator to chart” from the window where I write the indicator but this time it didn’t work. Thank you for your help with this Nicolas
03/12/2018 at 10:12 PM #65146Hi,
I am trying to add this indicator to a trading system but not sure how do I call the arrows which are my signals to buy or sell. Thanks
03/13/2018 at 10:12 AM #65170Since your indicator’s code is not returning any value but only a graphical component, you have to copy/paste the code into your strategy and use ‘result2’ variable as a trigger for your order:
123456789101112131415L0=Low[0]C1=Close[1]Truelow0 = Min (L0,C1)L1=Low[1]C2=Close[2]Truelow1 = Min(L1,C2)L2=Low[2]C3=Close[3]Truelow2 = Min(L2,C3)Result1 = Min(Truelow0, Truelow1)Result2 = Truelow2 < Result1if Result2 then// BUY OR SELLSHORT CODE GOES HEREendif -
AuthorPosts
Find exclusive trading pro-tools on