NextTradeBar = _Period*60 + Time[i]; // Time[i] = bar of last trade if (TimeCurrent() <= NextTradeBar) return; // untested!!2) don't understand what you want.
augi182:
what is best way for trade once per bar ??? or for create only 1 object at bar.
and how I can do to procced my EA full? I mean to ignoring new tickets to reset my ea from a new beginning on every tick so ea can procced all code in it.
bool checkNewBar(int barPeriod, bool initOnly) { if(barPeriod<=0 && initOnly==true) return(false); int timeOldBar=0; switch(barPeriod) { case PERIOD_M1: static int timeOldBarM1 =-1; timeOldBar=timeOldBarM1; break; case PERIOD_M5: static int timeOldBarM5 =-1; timeOldBar=timeOldBarM5; break; case PERIOD_M15: static int timeOldBarM15=-1; timeOldBar=timeOldBarM15; break; case PERIOD_M30: static int timeOldBarM30=-1; timeOldBar=timeOldBarM30; break; case PERIOD_H1: static int timeOldBarH1 =-1; timeOldBar=timeOldBarH1; break; case PERIOD_H4: static int timeOldBarH4 =-1; timeOldBar=timeOldBarH4; break; case PERIOD_D1: static int timeOldBarD1 =-1; timeOldBar=timeOldBarD1; break; case PERIOD_W1: static int timeOldBarW1 =-1; timeOldBar=timeOldBarW1; break; case PERIOD_MN1: static int timeOldBarMN1=-1; timeOldBar=timeOldBarMN1; break; } int countFrom; int count=0; if(barPeriod<=PERIOD_H1) {countFrom=PERIOD_H1;} else countFrom=barPeriod; while(count<=countFrom-barPeriod) { if(timeOldBar<0 || (TimeMinute(TimeCurrent())==count && TimeCurrent()>=iTime(NULL,barPeriod,0) && count!=TimeMinute(timeOldBar))) { Print("tttt ",TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent())," count->",count," TimeCurrent->",TimeCurrent()," timeNewOpen->",iTime(NULL,barPeriod,0)," timeOldBarOpen->",timeOldBar ); switch(barPeriod) { case PERIOD_M1: timeOldBarM1 =iTime(NULL,barPeriod,0); return(true); case PERIOD_M5: timeOldBarM5 =iTime(NULL,barPeriod,0); return(true); case PERIOD_M15: timeOldBarM15=iTime(NULL,barPeriod,0); return(true); case PERIOD_M30: timeOldBarM30=iTime(NULL,barPeriod,0); return(true); case PERIOD_H1: timeOldBarH1 =iTime(NULL,barPeriod,0); return(true); case PERIOD_H4: timeOldBarH4 =iTime(NULL,barPeriod,0); return(true); case PERIOD_D1: timeOldBarD1 =iTime(NULL,barPeriod,0); return(true); case PERIOD_W1: timeOldBarW1 =iTime(NULL,barPeriod,0); return(true); case PERIOD_MN1: timeOldBarMN1=iTime(NULL,barPeriod,0); return(true); } } count=count+barPeriod; //Print("**************** ",count); } return(false); }
2) example I mean that EA ignore new tickets for 10 second(ea didnt start from beginning of his code for 10 seconds)
augi182:
2) example I mean that EA ignore new tickets for 10 second(ea didnt start from beginning of his code for 10 seconds)
2) example I mean that EA ignore new tickets for 10 second(ea didnt start from beginning of his code for 10 seconds)
You stated trade 'once per bar'. MT4 does not support less than M1.
augi182:
2) example I mean that EA ignore new tickets for 10 second(ea didnt start from beginning of his code for 10 seconds)
Create a timer then.
2) example I mean that EA ignore new tickets for 10 second(ea didnt start from beginning of his code for 10 seconds)
And how? I never do anything with time :(
augi182: And how? I never do anything with time :( |
|
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
what is best way for trade once per bar ??? or for create only 1 object at bar.
and how I can do to procced my EA full? I mean to ignoring new tickets to reset my ea from a new beginning on every tick so ea can procced all code in it.