Hello,
I’d like to call in my system the BARINDEX[n] of the LAST Low and the last High of STD[20] (not the highest[p] or Lowest[p]), because if I use highest[p], it is possible that the result is the second to last (if it’s higher than the last one). So the question is if I’m at the last candle what’s the number [n] of the last high of STD.
I tried Array with no success certainly due to my limited skills. It should look like this:
iSTD = STD[20]
// find "n" which corresponds to the number the of the last High / Low of iSTD
cond1 = iSTD[1]>iSTD and iSTD[1]>iSTD[2]
cond2 = iSTD[1]<iSTD and iSTD[1]<iSTD[2]
//find "n"
return n
Thanks a million.
If you don’t use any period, any bar can be either the new LOW or the new HIGH.
You always have to set an interval/range, usually it’s periods, or the whole data history.
Try this one:
If iSTD < iSTD[1] then
LowBAR = barindex
Endif
If iSTD > iSTD[1] then
HighBAR = barindex
Endif
LowBAR and HighBAR are the barindex numbers you are looking for.
Hi Khaled and robertogozzi.
How would u use this in a strategy.
I trying to make a simple and hopefully as robust strategy as possible.
A mtf strategy with 1 indicator with inspiration from Jebus89
timeframe daily: rsi 2 > 95
timeframe 4 hours: rsi 2 > 95
timeframe 1 hour: rsi crosses under 95
Sell at daily timeframe when rsi 2 crosses under 30
MultiTimeFrame simple conditions
Someting like this but maybey with std highbar lowbar. What do u think?
Hi SnorreDK
Thanks for your feedback and the suggestion to use RSI[2] crossing on higher TF.
What I observed on the attached graph, is that if you go Long or Short according to your entry point and want to optimize Exit point (not too early, not too late), then you should Exit at the next turning point of the STD. Obviously I tried the following but it didn’t give optimum result.
if shortonmarket and (close>close[1] and high>high[1] and low>low[1]) then
exitshort at market
endif
if longonmarket and (close<close[1] and high<high[1] and low<low[1]) then
sell at market
endif
Any clue how to code this LAST STD[20] turning point?
You simply have to check when STD[20] is greater or lower than the prior bar.
Thanks robertogozzi, you always save me time. Often times, the simplest solutions are the best.
If u come up with something it would be intresting to see khaled
So just to update you… I tested exit option (1) cross over/under RSI[n] as suggested above vs. (2) STD reversal and the RSI outperforms by far, despite the STD looks very on the graph :). This is obviously based on my system, it doesn’t mean it’s true across the board.
Intresting.
Thanks for ur feedback khaled.
What entryposition do u use
You mean my system? it’s based on a combination of Stochastics, MACD, MAs with a few filter. Still under development.