how many candles?
-
Hello, I want to count how many candles passed since group1's first trade.
-
You can create a double variable that will increase +1 as candles pass (juast checking once per bar, obviously). You should initialize at the group1 first trade and reset it when required.
-
@fxalex Do you need to know the number of candles? Or do you just want to make sure that a certain amount of time has passed since close of the trade. In the last case you maight use this..

Unfortunately you cannot specify a minimum candle number, just time parameters.
-
I need a variable to know the number of candles since the first trade in the sequence.
-

here I have a buy and a sell and a want to draw a line above the highest candle since the first trade.... -
@fxalex And how do you identify the start of the sequence?
-
@l-andorrà hello . can you post this idea with fxdreema i'm new and i try to use right. thanks
-
@fxalex said in how many candles?:
@l-andorrà hello . can you post this idea with fxdreema i'm new and i try to use right. thanks
Sure. The question of trader.philips is very pertinent. When is the sequence supposed to start? I mean, in what conditions exactly?
-
trader place line above highest candle of price action for uptrend or lowest candle for downtrend
no trades
no trade - if price above line (named gold line) and above 55ma - buy 0.1 group 1
no trade - if price below line (named gold line) and below 55ma - sell 0.1 group 2if trade
group1 & price below 55ma & price below line - open sell 0.2 group 3 (add break even) draw line above highest candle since group 1 first trade
group2 & price above 55ma & price above line - open buy 0.2 group 4 (add break even) draw line below lowest candle since group 2 first tradeand keep opening opposite trades (4-5 turns the final trade is closing with loss) (can i add this losses to the "profit target"?)
if profit close all......reset the variable
my problem is that now it places the line in a "set number of candles" and if in zig - zag price action if 105 candles have passed like pic above my ea draw the line in the middle

-
https://fxdreema.com/shared/ySaaK92Ac - I cant find the thread this is from but this counts the amount candles since trade closed and might help you. Mess around with on trade and add the conditions you want.
-
An impressive project, certainly! Try what Hadees shared and let us know, please.
-
Not sure if this is what you are looking for but it´s my way

When there is no position running, BarCounter is set to 0 each time a new bar opens.
When there is a position running, BarCounter is set to BarCounter+1 each time a new bar opens.