open buy / sell position
-
Good afternoon, I need some help please. I created my first EA. The expert should buy if the previous close of the candle is above the high of a moving average and a sell position should be open when the previous close of the candle is below the other moving average. The position should be open on the current candle. The EA works but not as I would like, because the positions are opened before the close of the previous candle, that is, they open the position on the current candle and before the crossing with the moving average. Can someone help me? I did not find the answer in the Forum, if there was already an answer and someone wanted to report the discussion to me I would be grateful. Thanks bye. Fabio
-
@baccicin Hello. Could you share your project with link ?
-
sure, https://fxdreema.com/shared/3KChZHJ8e
thanks a lot -
@baccicin Thanks.
What is the number of your Moving Average ? MA8 ? MA4 ?
Do you have settings (TP, SL, etc.) ? Cause, like that, your EA works but it does nothing.
-
ah, i left it "empty" just to try and change the combination everytime, just to learn... it's not a trading system, it's just to have a starting point. What i am trying to get is that the code should wait the close of the candle and, if there is a cross on the high or on the low of a moving average, a position should be open. On contrary, in this moment, the code open positions on the current candle and often without a cross
-
@baccicin That depends on what you exacly want. You current configuration is searching for crossinf on candle ID 1 while you apparetly are looking for crossings on highs/lows. Could you please provide a more detailed list of conditions to be met?