Saving variables for reference use?
-
Hello, l want to have a logic that if price should wick above or below a line on chart as in the picture below, trigger an act maybe buy. It basically the ability to spot rejections around an area and the price does not have to follow each other.
How Can l do it? @ambrogio @l-andorrà @jstap @PhiLykia

-
candle low below the line, candle close/open (both condition togheter) above the line.
-
@ambrogio yes, but the logic is l want to count how many times that happened, in this case it happened 3 times, so how do i get that data value that the line as being wicked three times?
and also that the candle might not follow each other there could be 2 candles in-between the next wick
-
you have to create a variable that counts the number of times. When conditions are met once per bar modify variable count=count+1
You want to count only consecutive wick? In this case you have to reset the variable (or simply make the condition in a row from candle ID1 to candle ID3) -
@ambrogio in this case I'm not counting consecutive wicks but the number of times it wicks through
for example, with it wicks through for 3 times, open a long position.
-
@ambrogio i think this is the idea so once its up to 3, trigger open order
you have to create a variable that counts the number of times. When conditions are met once per bar modify variable count=count+1
Can you explain how show me how to go about this?
-
Does it matter if these 4 candles are bullish or bearish (bullish/bullish)?
There are no wicks on the candles. shouldn't it be?What do you anticipate taking as a reference for the line you have drawn? You need to define that line.
-
@tec-nacks said in Saving variables for reference use?:
@ambrogio in this case I'm not counting consecutive wicks but the number of times it wicks through
for example, with it wicks through for 3 times, open a long position.
3 times the same wick up and down, so the same candle? or 3 wick of 3 candles?
-
@ambrogio it is 3 wicks of 3 different candles.
-
@PhiLykia it is to identify rejections.
and its can be either bullish or bearish candle - the only different is either upper wick or lower wick which in this scenario it is lower wicks.
-
@tec-nacks said in Saving variables for reference use?:
@ambrogio it is 3 wicks of 3 different candles.
should be like this, i didn't test


-
@ambrogio Waow...Just the perfect Logic.
I'll go test it and feedback
-
@ambrogio it's not working. I tried checking further and realized that it still keeps counting on even when 3 is reached is still didn't trigger the next condition.
So I'm thinking is there a way to reset the number after 3 and to lock it when its exactly 3 and also why it isnt triggering entering even when 3 is reached?
-
you are missing the variable "coun" and you are making a boolean condition instead value numeric count == 3 numeric
You are searching a line named "line" , are you drawn it manually yes? -
@ambrogio I fix the count error here: https://fxdreema.com/shared/o1URcLfE
and for the line, the line is the reference. when the candle wicks the line 3 times, it should draw the arrow according to the block

like in this picture, there was no arrow drawn
-
still missing the variable. In this link we draw a "line" at 0.6678 on AUDUSD
Check ithttps://fxdreema.com/shared/OkicvGymd
backtest from 15/05/2023
-
@ambrogio ok on it
-
@ambrogio thank you so much, all is good now i've fixed the observed gap.
Unto our next thread, counting on you boss
-
