読み取り専用

フォーラムは現在、読み取り専用のアーカイブとなっています。.

バグ報告やプラットフォームに関する質問はこちら → [email protected]

私たちのコミュニティはDiscordとYouTubeで活動しています。ぜひ参加してください!

ご参加ください Discord YouTube

Restrict to opening one trade (with Take Profit and Stop Loss) per bar

1件の返信

gkouro

購読者, bbp_participant, 0 返信.

プロフィールを表示

6年前 #256168

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

Tomas Matejka

管理者、sq-ultimate、2件の返信.

プロフィールを表示

6年前 #256616

こんにちは,

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件中)