Enter Previous Candle Close in a Variable
-
Hi everyone,
I'm new here, trying to create my first EA on fxdreema.
Here's what I want to do:
TRADE ENTRY
- When price crosses above 21 EMA (high prices), mark the candle close (variable : High_Alert) i.e store it in a variable.
- When any subsequent candle closes above the High_Alert, ENTER THE BUY TRADE.
TRADE EXIT
3) When price crosses below 21 EMA (low prices), mark the candle close (variable : Low_Alert) i.e. store it in a variable.
4) When any subsequent candle closes below the Low_Alert, EXIT THE BUY TRADE.Here's the project I've created to execute that.
https://fxdreema.com/shared/OzkjRXSHc
However, when I run a backtest with this EA, it doesnt enter any trades.
Can someone please help me understand what I'm missing here.
Thanks in advace!
-
@karant
https://fxdreema.com/shared/OzkjRXSHc
it is the algorithm for blocks -
@Xfire : Thank you for your response. Could you please help me understand what you mean?
-
@karant You cant add "Close position" block to "Buy" block.
always use "Buy" and "Sell" blocks as last blocks
after open position use "If position " block for control your position -
I changed the last block to sell.
Still no trades in the back test. still feel im missing something.
https://fxdreema.com/shared/xKluEmBZ -
Is not taking trades likely becaus you have once per bar above conditions, either way I would test each part separately so I know what's causing problems.
-
@karant Your block 5 never cant pass condition.
-
@karant What are you doing with block 4 !!!
-
@jstap and blocks 7,8,9 , you can remove all. i show you before if you don't want to learn then do not ask in topic
-
@Xfire: in block 4 my intent is to store the previous candle close in the variable High_Alert. To later use it to check for a close above this level to enter a trade.
-
@Xfire : why won’t it pass? I’m checking for a close above the close of candle which crosses over the moving average.
-
@jstap : yes I will remove each block and try
-
@Xfire I assume you pointed that reply at the wrong person

-
@jstap : Yeah
-
@Xfire : I removed all the additional steps - the EA takes trades on close above MA crossover now. Thanks - was good to see the EA actually do something.
How do I store a crossover candle close value in a variable now and enter trade when price closes above it?
-
I've put the the entry and exit into separate areas.
Still being unable to enter order. Requesting help to enter a buy trade when price closes above the crossover candle close.
-
@karant
What does it mean, Candle 1 > Candle 1 ?!!!!! this block never pass

-
I've stored the close of the Crossover Candle (Candle 1 immediately upon crossover) in the variable Buy_Alert (not sure if the algo is doing that - but thats the intent).
Then checking if any subsequent candle (respective Candle 1 from time to time) closes above the value store in Buy Alert - this is the confirmation to enter buy trade.
-
@karant it is not the next candle. it is the current candle. you can compare the candle 1 and 2 at the same time.
You don't know about algorithm. just first read some information about how can create algorithm for coding. it is better for your time . -
Candle 0 is current, candle1 is previous and closed, close on 0 is the current price.