Jump to content

cara buat timer di ea


Recommended Posts

Re: (req )cara buat timer di ea

 

pertama.

di setting parameter kita bikin dulu, untuk input datanya

misalnya

extern string Time_Inputs = " Timing parameters ";

extern int StartHour = 0; // Start Hour of Trade Session

extern int StartMinute = 0; // Start Minute of Trade Session

extern int EndHour = 23; // End Hour of Trade Session

extern int EndMinute = 0; // End Hour of Trade Session

extern int CloseTimeMode = 0; // CloseTime mode: 0-off,1-on

extern int CloseHour = 24; // Trade Close Hour

extern int CloseMinute = 0; // Trade Close Minute

 

terus, di logicnya

kita masukan saja

dibawaha baris

 

int init()

 

bool TimeCondition()

{

bool result = false;

 

datetime SessionStart = StrToTime(StartHour+":"+StartMinute);

datetime SessionEnd = StrToTime(EndHour+":"+EndMinute);

 

if (StartHour < EndHour)

result = TimeCurrent() >= SessionStart && TimeCurrent() < SessionEnd;

else

if (StartHour > EndHour)

result = (TimeCurrent() > SessionStart && TimeHour(TimeCurrent()) < 24)

||(TimeHour(TimeCurrent()) >= 0 && TimeCurrent() < SessionEnd);

 

return(result);

}

 

macam2 sih tekniknya,

bisa juga model simpel begini

 

input parameternya

extern bool UseHourTrade = True;

extern int FromHourTrade = 8;

extern int ToHourTrade = 18;

 

logic nya

int start() {

if (UseHourTrade){

if (!(Hour()>=FromHourTrade && Hour()<=ToHourTrade)) {

Comment("Time for trade has not come else!");

return(0);

}

}

 

mudah2an bisa membantu..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...