I have created several variables, but cannot save the EA as .EX4 because I get a little warning window that states against each one: 'Constant expected'. These are variables measuring atr in pips, candle ID1 body size, pivot points etc, which surely should be variables, not constants. What am I doing wrong, and how to I overcome this?
Latest posts made by JASimon
-
fxdreema won't allow me to create EA with variables, only constantsposted in Questions & Answers
-
RE: How to set a stop by 2ma crossing 6ma together with a tp by psar.posted in Questions & Answers
@l-andorrà On further thoughts, I think I am asking for something that can't be done. But if you can solve this for me, that would be really good.
But if not, I could set a condition of the 2ma crossing the 6ma, and if I accept that this will only pass at the close of candle 1, I can then precede this block with the block 'pips away from open price', to set a tight stop.
My tp can be set by 'modify stops' setting the psar. Thus, when in profit, the trade will be closed by the psar, and when losing, the trade will be closed by whichever happens first/closest to the price at which the trade opened. J.
-
RE: How to set a stop by 2ma crossing 6ma together with a tp by psar.posted in Questions & Answers
@l-andorrà Thanks for responding. Not sure how to add to my ling usefully: When setting a condition with ma crossover, the candle id must be chosen, and id0 will not work. id1 means the condition will pass when the candle closes - not when the ma cross occurs.
It has just occurred to me that I can do this with the pink pips away from open price, followed by the ma cross. Does that sound right? John
-
How to set a stop by 2ma crossing 6ma together with a tp by psar.posted in Questions & Answers
I am setting up an MT4 EA that opens the trade based on 'risk % of balance' with the stop-loss for a Buy set at the low of the previous two candles.
If a buy trade moves into loss, I want it to close as soon as the 2ma crosses the 6ma - straight away, not later on when that candle (id 1) closes. And, I would like to take profit when the price reaches the psar (straight away when the candle moves below the psar - not later, when that candle (id 1) closes.
I have tried this by setting the tp in the Buy Now block, and the Modify Stops for the stops. I have also set the Buy Now to No Take profit, exchanged modify stops to Modify stops of Trades - setting both modified stop and modified tp. None of these work, and I don't think they can work.
I need help please, either how to set up these blocks so they do work, or explaining how to go about it some other way.
This link shows some things I have tried, but I cannot see how they can give me what I want, and in any event, they do not work. Here is a link to a couple of examples of what I have tried, but clearly, I don't know how to do this.