読み取り専用

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

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

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

ご参加ください Discord YouTube

Delay order send by x minutes

2件の返信

David Fox

カスタマー、bbp_participant、コミュニティ、0件の返信。.

プロフィールを表示

8年前 #234616

Hi All

I have developed an EA in SQ EA Wizard to trade daily (on the daily charts), it opens a trade at the start of the new trading day, in order to avoid any gapping in the price level I need to delay the opening of the order by say 5 minutes into the new day.

I have tried all the methods I know and have found reference to such code in the sample portfolio:-

extern int OpenBarDelay = 0; // open bar delay in minutes
// it can be used for Daily strategies to trigger trading a few minutes later –
// because brokers sometimes have technical delay after midnight and we have to postpone order

and the corresponding reference to OpenBarDelay

//+——————————————————————+

void drawStats() {
// changed recognition of bar open to support also range/renko charts
static datetime tmp;
static double open;

if (tmp != Time[0]) { // } || open != Open[0]) { – this doesn’t work with renko charts

bool processBarOpen = true;

if(OpenBarDelay > 0) {
// set bar to open only after X minutes from real open
processBarOpen = false;

int diffInSeconds = TimeCurrent() – Time[0];
if(diffInSeconds >= OpenBarDelay * 60) {
processBarOpen = true;
}
}

if(processBarOpen) {
tmp = Time[0];
open = Open[0];

sqIsBarOpen = true;
}
} else {
sqIsBarOpen = false;
}

I need to know either:-

1. Where to insert the above code (if that is all that I need) into the source code of my EA in MetaEditor

または

2. Write it in SQ EA wizard

心より感謝申し上げます。

0

Tomas Matejka

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

プロフィールを表示

8年前 #234618

こんにちは,

you can try a simplier method. Just use the Sleep function as show here https://docs.mql4.com/common/sleep

In EA Wizard add Other -> Custom Action before placing an order and set the parameter as “Sleep(60000);” for 1 minute delay

NOTE: Sleep() function does not suspend execution of the Expert Advisor in the Strategy Tester

0

David Fox

カスタマー、bbp_participant、コミュニティ、0件の返信。.

プロフィールを表示

8年前 #234636

心より感謝申し上げます。

0

2件の返信を表示中 - 1 - 2件目 (全2件中)