HedgeEA - page 59

claypot
94
claypot  

Trading Time code

//+------------------------------------------------------------------+

//| CODE FOR TRADING TIMES - VARIABLES - From TradingTimes.mq4 |

//| Edited by Minnelli - Forex Signal Providers - Journal |

//+------------------------------------------------------------------+

extern string sm0="--Trading Hours--";

extern string sm1=" Times are GMT when UseDST=false";

extern bool UseTradingHours = true;

extern string sm2 = "GMT Offset default is for FXDD";

extern int GMT_Offset = 3;

extern bool UseDST = false;

extern string sm3 = "Use Asian Market if trading only 1 period";

extern bool TradeAsianMarket = true;

extern int myAsianStart = 2200; // Start trades after time 2200

extern int myAsianStop = 100; // Stop trading after time 100

extern bool TradeEuropeanMarket = false;

extern int myEurStart = 700; // Start trades after time 700

extern int myEurStop = 900; // Stop trading after time 900

extern bool TradeNewYorkMarket = false;

extern int myNYStart = 1300; // Start trades after time 1300

extern int myNYStop = 1500; // Stop trading after time 1500

int AsianStart; // Start trades after time

int AsianStop; // Stop trading after time

int EurStart; // Start trades after time

int EurStop; // Stop trading after time

int NYStart; // Start trades after time

int NYStop; // Stop trading after time

bool CheckTradingTimes;

//+------------------------------------------------------------------+

//| CHECK TRADING TIMES (START) |

//+------------------------------------------------------------------+

bool CheckTradingTimes()

{

bool StopTrading;

int ct;

bool AsianMidnight;

bool EurMidnight;

bool NYMidnight;

ct = Hour() * 100 + Minute();

//+------------------------------------------------------------------+

//| TIME CORRECTION |

//+------------------------------------------------------------------+

int TimeCorrection;

TimeCorrection = 100 * GMT_Offset;

if (UseDST == true)

{TimeCorrection = TimeCorrection - 100; }

AsianStart = myAsianStart + TimeCorrection;

AsianStop = myAsianStop + TimeCorrection;

EurStart = myEurStart + TimeCorrection;

EurStop = myEurStop + TimeCorrection;

NYStart = myNYStart + TimeCorrection;

NYStop = myNYStop + TimeCorrection;

//+------------------------------------------------------------------+

//| STOP TRADING CHECK |

//+------------------------------------------------------------------+

StopTrading = true;

//+------------------------------------------------------------------+

//| Check trading Asian Market |

//+------------------------------------------------------------------+

if (StopTrading == true)

{

if (TradeAsianMarket == true)

{

if (AsianStop - AsianStart < 0) AsianMidnight=true;

if ((AsianMidnight==false && ct>=AsianStart && ct<=AsianStop)) StopTrading = false;

if ((AsianMidnight==true && ct>=AsianStart && ct<=2400)) StopTrading = false;

if ((AsianMidnight==true && ct>=000 && ct<=AsianStop)) StopTrading = false;

}

}

//+------------------------------------------------------------------+

//| Check Trading European Market |

//+------------------------------------------------------------------+

if (StopTrading == true)

{

if (TradeEuropeanMarket == true)

{

if (EurStop - EurStart < 0) EurMidnight=true;

if ((EurMidnight==false&&ct>=EurStart && ct<=EurStop)) StopTrading = false;

if ((EurMidnight==true&&ct>=EurStart && ct<=2400)) StopTrading = false;

if ((EurMidnight==true&&ct>=000 && ct<=EurStop)) StopTrading = false;

}

}

//+------------------------------------------------------------------+

//| Check Trading New York Market |

//+------------------------------------------------------------------+

if (StopTrading == true)

{

if (TradeNewYorkMarket == true)

{

if (NYStop - NYStart < 0) NYMidnight=true;

if ((NYMidnight==false&&ct>=NYStart && ct<=NYStop)) StopTrading = false;

if ((NYMidnight==true&&ct>=NYStart && ct<=2400)) StopTrading = false;

if ((NYMidnight==true&&ct>=000 && ct<=NYStop)) StopTrading = false;

}

}

//+------------------------------------------------------------------+

//| Return value to CheckTradingTimes |

//+------------------------------------------------------------------+

return(StopTrading);

}

//+------------------------------------------------------------------+

//| CHECK TRADING TIMES (END) |

//+------------------------------------------------------------------+

claypot
94
claypot  

Hi,

Was anyone able to integrate the EA?? If so could it be posted, much appreciated.

Cheers.

kokas
503
kokas  

Can you please elaborate more your idea. What happen to open orders when non trading hours are reached? Close it? or keep it open?

Thanks

claypot
94
claypot  

Hi Kokas,

Thanks for pointing that out.

Yes, if it's possible could you allow for both options to be available, hence the user can select whether to close or keep the positions at the end of trading hours, otherwise just close all positions will suffice.

Cheers.

dvarrin
279
dvarrin  

Hi,

Could anybody explain me what is the swap and how we can use it for hedging?

I would also like to know how we can use correlations of 3 pairs? What is the difference compared with the hedging of two pairs?

Thank you very much in advance!!

Hisashi
5
Hisashi  

How do I open multiple hedged positions with HedgeEA?

I could open 1 set of hedged positions (the same currency, same lot size) but failed to open more.

If I have 1 set of hedged position with my broker, only the spread cost is deducted from the balance, and I could have more positions.

(i.e., if Balance=$20000 and have 1 lot EUR/USD hedged, the equity would be (The balance - 2 * spread cost)=$19600)

So, I wanted to take more hedged positions but could not.

Can anyone help me with that?

kokas
503
kokas  

Anyone still testing HedgeEA?

is anyone still testing hedgeEA? if so could someone post some results? I've been away for sometime but I'm back now

freedom131477
92
freedom131477  

ill try

kokas:
is anyone still testing hedgeEA? if so could someone post some results? I've been away for sometime but I'm back now

hi

just discover those EA

now i am reeding all posts and will try test

What is last or best version you have

thanks

freedom131477
92
freedom131477  

try

hi

ill try

what is last or best version what you have?

thanks

kokas:
is anyone still testing hedgeEA? if so could someone post some results? I've been away for sometime but I'm back now
freedom131477
92
freedom131477  

i whantn try

what is last version of ea?

kokas:
is anyone still testing hedgeEA? if so could someone post some results? I've been away for sometime but I'm back now