STRATEGY TESTER: MarketInfo(symbol,MODE_MARGINREQUIRED);

To add comments, please log in or register
rob
106
rob  

This code executes as it should in normal operation. In strategy tester the value in the print statement for marginRequired is zero.

Anything I can do to the system to make it come alive in strategy tester?

Metatrader4 version 4 build 1090 19th May 2017

{it is a method of an object}


   //+------------------------------------------------------------------+
   //|set variable values                                               |
   //+------------------------------------------------------------------+
   void setVariableData(int timeFrame=5,int period=14,int adxBefore=14,int mBars=2000,double risk=0.04,double am=100)
     {
      bid=MarketInfo(symbol,MODE_BID);//Update Bid and set initally     
      spread=ask-bid;
      adx=iADX(symbol,timeFrame,period,PRICE_CLOSE,MODE_MAIN,1);

      adxr=iCustom(symbol,timeFrame,"ADXR",period,adxBefore,mBars,3,1);
      atr=iATR(symbol,timeFrame,period,1);
      atrMoney=atr*lotSize;  
      marginRequired=MarketInfo(symbol,MODE_MARGINREQUIRED);       
Print(__FUNCTION__," margin required ????symbol ",symbol," ",marginRequired);        
      if((adxr==EMPTY_VALUE) || (marginRequired<=0) || (spread<=0))
        {
         descr="NOT ENOUGH DATA";
         adx=0;
         adxr=0;
         atr=0;
         csi=0;
         return;
        }
      setCappedWTFData(risk);
     }
To add comments, please log in or register