walidabou: so what's the difference between this code and my own code ??
Your code was A && B meaning both must be true at the same time. His code is CrossCondition was seen and now ChicospanCondition is seen. If you still can't see it. Print out your variables, and find out
why.
if(Close[2] < kijun line and Close[1] > kijun line)
CrossCondition=CrossedUp;
if(CrossCondition==CrossedUp && ChicospanCondition)
{
Place Order;
CrossCondition=None;
}
The above is pseudo code amd will allow only 1 trade per cross
You should also include code to check only when a new bar opens
walidabou: Thank you ,, but i didn't understand the code much ,, could you explain more if you don't mind
walidabou: but this code mean that the both two conditions must be true in sametime ,, or not ??
No,
CrossCondition is a global variable that is initialized to None.
if(Close[2] < kijun line and Close[1] > kijun line)
CrossCondition=CrossedUp;
When a cross is detected CrossCondition is set to CrossedUp
if(CrossCondition==CrossedUp && ChicospanCondition)
{
Place Order;
CrossCondition=None;
}
In the same or following bars, CrossCondition remains set to CrossedUp until the Chicospan condition is met. Then a trade is placed and CrossCondition is set to None so that no more trades are placed on the same cross. Then the EA will check for a new cross.
Obviously you will also need code for the opposite cross.
thank you very much ,, but after creating the code and making a backtest ,, it opens only one order ,, and then ,, it doesn't open any more orders when new cross happens.
walidabou: thank you very much ,, but after creating the code and making a backtest ,, it opens only one order ,, and then ,, it doesn't open any more orders when new cross happens.
walidabou: , but after creating the code and making a backtest ,, it opens only one order ,, and then ,, it doesn't open any more orders when new cross happens.
with this code i added a third condition which is (the price is above Kijun and tenken and span A and span b on M30 Timeframe) and fourth condition which is (Close[1] > Close[27] on M30 Timeframe)
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
His code is CrossCondition was seen and now ChicospanCondition is seen.
If you still can't see it. Print out your variables, and find out why.
GumRai:
//Globalscope enum condition{ None,CrossedUp,CrossedDown }; condition CrossCondition=None;The above is pseudo code amd will allow only 1 trade per cross
You should also include code to check only when a new bar opens
Thank you ,, but i didn't understand the code much ,, could you explain more if you don't mind
but this code mean that the both two conditions must be true in sametime ,, or not ??
No,
CrossCondition is a global variable that is initialized to None.
When a cross is detected CrossCondition is set to CrossedUp
if(CrossCondition==CrossedUp && ChicospanCondition) { Place Order; CrossCondition=None; }In the same or following bars, CrossCondition remains set to CrossedUp until the Chicospan condition is met. Then a trade is placed and CrossCondition is set to None so that no more trades are placed on the same cross. Then the EA will check for a new cross.
Obviously you will also need code for the opposite cross.
thank you very much ,, but after creating the code and making a backtest ,, it opens only one order ,, and then ,, it doesn't open any more orders when new cross happens.
with this code i added a third condition which is (the price is above Kijun and tenken and span A and span b on M30 Timeframe) and fourth condition which is (Close[1] > Close[27] on M30 Timeframe)
It is right code ??