読み取り専用

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

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

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

ご参加ください Discord YouTube

Is special handling of variables required when using EA on various timeframe charts of same symbol?

2件の返信

eawNewbie

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

プロフィールを表示

10年前 #115149

The scenario:

 

On one account

I use same EA on various currency pairs

Each currency pair will likely have at least 2 Charts of different time-frames (possibly M15, M30 & H1) open simultaneously.

Each EA instance handles trades using individual Magic numbers.

The EA contains variables and Array’s running on each Time-Frame.

 

 

(This array is just an example)

//---(CCI Signal)
int cciIndex() {
    double cci[];
    ArrayResize(cci,5);
    for(int i=0; i<3; i++)
    cci[i] = iCCI(NULL, 0 , 8 , 5 , i);
    CCI_index=9;
    if(cci[1]>100 && cci[0]<cci[1] && cci[1]>cci[2]) CCI_index=1;
    else if(cci[1]>100 && cci[0]<100) CCI_index=2;
    else if(cci[1]<-100 && cci[0]>cci[1] && cci[1]<cci[2]) CCI_index=-1;
    else if(cci[0]>-100 && cci[1]<-100) CCI_index=-2;
    else if(cci[0]>-100 && cci[0]<100) CCI_index=0;
    return (CCI_index);
}

The above example placed into the custom functions area of EA Wizards code structure have variables which maybe initialized multiple times on one MT4 platform.

 

1.  How does MT4 identify each variable considering they are initialized with same name (identifier) specifically ” cci ” & ” CCI_index ”  ?? 

2.  Do I need to provide a unique name for each variable when attached to each chart (whether same symbol or not)?

 

My concern obviously is the variable ” cci [1] ” which may contain a value from another time-frame chart.

 

 

 

 

ありがとう

0

マーク・フリック

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

プロフィールを表示

10年前 #137190

this is not a problem, because each EA runs in its own separate “space”, so even if you have multiple EAs using the same variable, each EA uses its own local copy of the variable.

 

The only thing that is global in MT4 is orders, so make sure you set different Magic Number for each your EA.

マーク
StrategyQuantアーキテクト

0

eawNewbie

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

プロフィールを表示

10年前 #137209

Thanks for clarifying.  I had assumed this but after reading this article https://www.ea-coder.com/attach-multiple-expert-advisors-on-mt4/ I was not sure.  It appears the only concern is the handling of orders and yes each chart is assigned a unique Magic number.

 

I have been monitoring the output of each variable and so far there has not been any duplication or unexpected results.

 

ありがとう

0

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