Expert Advisor

 

I have built EA for deriv broker synthetic indices and stuck in its one of the important phase.... 

I want to add special margin call and stopt-out function in my EA... Can someone help me how can it be done... Because broker has set 50% for the stop out while i want to set at 70-80% ....


can someone elaborate? 


//--- Stop Out is set in percentage or money
   ENUM_ACCOUNT_STOPOUT_MODE stop_out_mode=(ENUM_ACCOUNT_STOPOUT_MODE)AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE);
//--- Get the value of the levels when Margin Call and Stop Out occur
   double margin_call=AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL);
   double stop_out=AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);
//--- Show brief account information
   PrintFormat("The account of the client '%s' #%d %s opened in '%s' on the server '%s'",
               name,login,trade_mode,company,server);
   PrintFormat("Account currency - %s, MarginCall and StopOut levels are set in %s",
               currency,(stop_out_mode==ACCOUNT_STOPOUT_MODE_PERCENT)?"percentage":" money");
   PrintFormat("MarginCall=%G, StopOut=%G",margin_call,stop_out);
  }

 
Of course one can not change the brokers value. But you are not forced to use it. You can check, if the brokers value is smaller then 70% ... and if it is true, then you can validate with the 70%-value the position to be opened and / or the trading-volume to be used.