Restrict to opening one trade (with Take Profit and Stop Loss) per bar
1件の返信
Hi I would like to restrict my bot (MT4) to open one trade per bar
via the AlgoWizard I have done the following:
Buy: Bars since Order Open for Long to be greater than 0(so at least one new bar until last long order open)
and Bars since Order Open for Short to be greater than or equal to 0 (I just use this because of the symmetrical conditions. It will always be True)
そして
Sell: Bars since Order Open for Short to be greater than 0 (symmetrical to above)
and Bars since Order Open for Long to be greater than or equal to 0 (symmetrical to above)
I attach the strategy
In MQL4 I have coded this as follows:
datetime prevtimeb;
datetime prevtimes;
...
void OnTick()
{
// BUY
if(buy_condition1 && buy_condition2 && prevtimeb!=Time[0])
(
Open_Order(OP_BUY,sl,tp);
prevtimeb=Time[0];
}
// SELL
if(sell_condition1 && sell_condition2 && prevtimes!=Time[0])
(
Open_Order(OP_SELL,sl,tp);
prevtimes=Time[0];
}
}
Backtesting both bots (with same conditions etc.) does not produce similar results.
何かアイデアはありますか?
0
こんにちは,
by default a strategy made with Wizard is set to trade once per bar open – it evaluates conditions on bar open only
0
1件の返信を表示中 - 1 - 1件目 (全1件中)