Experts: Multicurrency hedge example EA (overlay hedge)

 

Multicurrency hedge example EA (overlay hedge):

The example of multicurrency hedging implementation on a single chart in Metatrader 4.

Author: Simonas Aukscionis

 

This concepts sounds very interesting in fact it might just turn out to be very successful too...


I see great potential here.
 

The problem is that, can't possible to backtest on this platform, (mt4).

 
how the EA calculate lot size and what is the risk. I tried to test it in many brokers but doesn't open any trades on many brokers
 
I think this is a great one after I tried in a Demo acct.  thank you Simona Aukscionis for your kind contribution. may God bless you.
 

@Simonas Aukscionis 

Or Anyone can help me :


I like this EA, and have spent days to study it (Since I am not a either professional trader or professional IT guy ) but I still can not figure out some code/function.  I know some professional level Function like how to calculate "Correlation", or "ATR" is out of my knowledge, but some basic function I also fell confused about, for example:

- in Event Handling :

  Why Simone set up the  timer start at 1 o'clock every day? ( by Hour(0)== 1 , and by RecalculationDay =!Today() ) ..? 

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

//| Event handling fucntion                                          |

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

void OnTimer()

  {

   if(Hour()==1 && RecalculationDay!=Day()) PrepareSymbols();

   for(cnt=ArraySize(closemagic)-1;cnt>=0;cnt--) CloseBlock(closemagic[cnt]);

   for(cnt=ArraySize(posneg)-1;cnt>=0;cnt--) OpenBlock(pair1[cnt],pair2[cnt],posneg[cnt],magic[cnt],atrratio[cnt]);

   Comment("Total currently correlated symbol pairs = ",ArraySize(posneg),". Total open positions = ",OrdersTotal());

   return;

  }



- In " Lots()" define function, why he use the "500,000"  to divide the AccountLeverage, rather then just use the AccountLeverage to determine lots?

like this :

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

//| Calculate position volume                                        |

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

double Lots()

  {

   double maximumRisk=0.1;

   int lotsDigits=MathLog10(MarketInfo("EURUSD",MODE_MINLOT)); // I deleted " (int)-  "

   double lots=NormalizeDouble(AccountFreeMargin()*maximumRisk/(500000.0/AccountLeverage()),lotsDigits);

   if(lots>MarketInfo("EURUSD",MODE_MAXLOT))

      lots=MarketInfo("EURUSD",MODE_MAXLOT);

   if(lots<MarketInfo("EURUSD",MODE_MINLOT))

      lots=MarketInfo("EURUSD",MODE_MINLOT);

   return(lots);

  }





- the calculation floating points which Simonas used as taking profit :

-qte

ouble GetFloatingUsd(int MagicNo)

  {

   double TotalUsd=0;

   for(int i=OrdersTotal()-1;i>=0;i--)

     {

      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==MagicNo)

         TotalUsd=(OrderProfit()-OrderCommission()-OrderSwap());

     }

   return(TotalUsd); 



--- unqte --- 


Hope someone can help me to figure out little about this EA.  I hope if Simone can talk to me in order to help me, since I failed to add him as Friend, therefore I couldn't message him. 


Have a nice day everyone. 


Kind regards

Sean Lu

Reason: