guys, for those who never diligently read back the previous threads that some of them contained very IMPORTANT message..
here's the latest code you can refer to Â
1)in ATR_pips.mq4, the extern int ATR_Period=7; you can play around with 6 or 7 Â
2)You can refer to Azam's code (CableLari etc etc) as your base
=================================================
double ATRPeriod1 = 3.0;
double ATRPeriod2 = 4.0; // safer at 5 <-- sometime I like to switch around 4 or 5 Â
double ATRUpLimit1 = 13.0;
double ATRDnLimit1 = 7.0; Â
double ATRUpLimit2 = 21.0;
double ATRDnLimit2 = 16.0; Â
double ATRUpLimit3 = 28.0;
double ATRDnLimit3 = 25.0; Â
3)To solve the serious problem faced by all complaints of when Winning trades NOT close properly, you need the WHILE loop to sweep out all the active /pending orders to regain the profit happily ! Â
if (Pips >= MinProfit){
while(MyOrdersTotal(Magic) != 0) {
CloseAllTrades(1, Magic);
CloseAllTrades(2, Magic);
DeletePendingOrders(Magic);
} Â
4) To monitor if NASTY broker delays the time to prevent you earn happy pips
you may want to Print out below 3 parameters on your screen to see if they fool you around.
If they are good, the delay should NOT more than 0.55 min.
LET ME KNOW WHAT"S YOUR "DIFF" :)
X is an integer variable, offset of your location to the broker..
here i put if Diff more than/equal to 3 minutes, send an email to keep track Â
int LastNastyTimeStamp; <-- global variable Â
int init() {
LastNastyTimeStamp =0;
return (0);
} Â
..
..
string Local_Time = TimeToStr(TimeLocal(), TIME_MINUTES|TIME_SECONDS);
string Server_Time = TimeToStr(TimeCurrent()+ X*3600,TIME_MINUTES|TIME_SECONDS);
double Diff = NormalizeDouble(MathAbs(TimeLocal() - (TimeCurrent()+ X*3600))/60,2);
if (Diff >= 3 && LastNastyTimeStamp != TimeMinute(TimeCurrent()) ) {
SendMail("bad broker "+ Period(),
"EA:"
+ WindowExpertName()
+ "\n"
+ "Local Time:"
+ TimeToStr(TimeLocal(), TIME_DATE|TIME_MINUTES|TIME_SECONDS)
+ "\n"
+ "Server Time:"
+ TimeToStr(TimeCurrent()+ X*3600,TIME_DATE|TIME_MINUTES|TIME_SECONDS)
+ "\n"
+ "Server Time after added offset of +X hrs:"
+ TimeToStr(TimeCurrent()+ X*3600,TIME_DATE|TIME_MINUTES|TIME_SECONDS)
+ "\n"
+ "Delay for minutes:"
+ Diff); Â
LastNastyTimeStamp = TimeMinute(TimeCurrent());
}