Hey
I am playing about trying to write some simple code. I want to have a arrow up below the candle on the chart when Close > Close[1]And (Close > High[1]) and a arrow down when Close < Close[1] And (Close < Low[1]) but I want to write the code so it does not keep printing arrows on subsequent candles as price rises or falls but I honestly can’t seem to get it to work. I just want to pick up the swings at top and bottom according to the rules above. I am sure this is a really basic thing to ask but if someone could show me how you would write this I would be so grateful.
Thank you for any help you can give me.
You guys are the best
Steve
I moved your topic to the english forum.
There you go:
DEFPARAM CalculateOnLastBars = 100
Offset = 5 * pipsize //distance from low/high to plot arrow
IF close > high[1] THEN //which is also > close[1]
DRAWARROWUP(barindex,low - Offset) COLOURED(0,128,0,255)
ENDIF
IF close < low[1] THEN //which is also < close[1]
DRAWARROWDOWN(barindex,high + Offset) COLOURED(255,0,0,255)
ENDIF
RETURN
Ah wow so I even posted in the wrong part of the forum!!
You are probably wondering how I even managed to turn my computer on!
Thank you for the quick reply and the help
I actually managed to write something similar to the above but what I was meaning was I did not want the arrows to keep printing on the subsequent candles I don’t think I explained myself properly.
So it would look something like the picture attached only drawing the arrows circled and not the ones in between. Hopefully this makes sense
Thanks again for your help
Steve
- For a new topic, your title should be explicit enough to prompt the community to read your discussion.
“noob question” is not an appropriate title. It will not help any members to find relevant topics for their questions in the future.
You just have to let me know the features the circled candkesticks have to tell them from those not circled.
Oh sorry Nicolas I did not mean to cause any problems.
So what I mean is the circled candle is the first candle that close is greater than the last candles high or a close is lower than the last candles low.
Hopefully that makes sense, sorry for the confusion.
Steve
There you go, you can set Offset and LookBack to whatever value suits you best:
DEFPARAM CalculateOnLastBars = 100
Offset = 5 * pipsize //distance from low/high to plot arrow
LookBack = 15 //number of bars to scan to make sure it's the most recent low/high
IF close > highest[LoookBack](high[1]) THEN
DRAWARROWUP(barindex,low - Offset) COLOURED(0,128,0,255)
ENDIF
IF close < lowest[LoookBack](low[1]) THEN
DRAWARROWDOWN(barindex,high + Offset) COLOURED(255,0,0,255)
ENDIF
RETURN
Ah mate thank you so much.
I was really struggling with this. Thank you for your help and all you patience
All the best
Steve