MQL4 - How to extract data of an string Array/JSON - page 2

 

If it works it's probably ok.

It looks ok so i expect it to work.

 

Guys, In that script I have function to calculate the Lots, but this is not work for all pairs.


//+------------------------------------------------------------------+
//| Calculate Lot Size Per Trade                                     |
//+------------------------------------------------------------------+
double CalcLotSize(string symbol, double RiskPercent, double RiskInPips)
{
   double LotSize = 0;

   //We get the value of a tick
   double nTickValue = MarketInfo(symbol, MODE_TICKVALUE);
   double _digits    = MarketInfo(symbol, MODE_DIGITS);

   //If the digits are 3 or 5 we normalize multiplying by 10
   if(_digits==3 || _digits==5){
      nTickValue=nTickValue*10;
   }
   
   // Lots = Equity * Risk% / (Stop Loss in Pips * Pip Value) / 100
   LotSize = NormalizeDouble(AccountEquity()*(RiskPercent/100)/RiskInPips*nTickValue,_digits);
   LotSize = MathRound(LotSize/MarketInfo(symbol,MODE_LOTSTEP))*MarketInfo(symbol,MODE_LOTSTEP);
   
   if(LotSize<0.01) LotSize=0.01;

   return(LotSize);
}


double CalcLotSize(string symbol, double RiskPercent, double RiskInPips)

symbol = "EURUSD"
RiskPercent = 2
RiskInPips = 160


Someone can help me with this one?

 
ezequielgodoy:

Guys, In that script I have function to calculate the Lots, but this is not work for all pairs.



symbol = "EURUSD"
RiskPercent = 2
RiskInPips = 160


Someone can help me with this one?

Off topic...and discussed 3 million times on the forum.
 

Alain, can you put the link here please?

 
ezequielgodoy:

Alain, can you put the link here please?

You can't even search yourself ? I don't have a link, but I know there are a lot of topics about this. Do your home work please.
 
try to use percent based equity to calculate the lots
 
Marco vd Heijden #:

You can also just use csv.

I want to send a post request. But i have some question in JSON. the params is 

    params = {
        msgtype: 'markdown',
        markdown: {
            title: 'wh',
            text: text

        },

    };


res=WebRequest("POST", url, headers, 3000, data, result, str);


Can you help me? And how to encode the JSON params to char array?Thank you.

Reason: