Incorrect profit results- it's adding 30 pips extra per trade

 

Hi, I'm trying to figure out why the TakeProfit results in the terminal results window, is showing more profit per trade than the entry and exit prices would produce.

For .10 lot (10,000) it is showing a 60 pip range between my entry price and my exit price, yet it shows $98 profit rather than $60 profit. (pic looks a tad blurry today for some reason).

Any ideas why the Profit is more than the Entry and Exit range would indicate? The chart also shows no indications that the profit is higher than it should be.

Is there another setting I am neglecting somewhere?

This print out (directly below) is showing what the bid and ask is on this particular trade.

15:13:32 2013.03.07 02:34 Manna2copy1 EURGBP,M1: --------------------- 0.8674 0.8676
15:13:32 2013.03.07 02:34 Tester: take profit #21 at 0.86740 (0.86740 / 0.86757)
15:13:32 2013.03.07 02:35 Manna2copy1 EURGBP,M1: --------------------- 0.8672 0.8674

thanks

P.S. All trades occur with incorrect profit.

buyticket=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"Buy 1",MAGICMA,0,Blue); // shows 3 slippage.   

// after original order is sent, I then modify to set stop loss and take profit amounts. The take profit is set for 60 pips
OrderModify(buyticket,OrderOpenPrice(),bsl,btp,0,CLR_NONE); 
 
moneycode:

Hi, I'm trying to figure out why the TakeProfit results in the terminal results window, is showing more profit per trade than the entry and exit prices would produce.

For .10 lot (10,000) it is showing a 60 pip range between my entry price and my exit price, yet it shows $98 profit rather than $60 profit. (pic looks a tad blurry today for some reason).

Any ideas why the Profit is more than the Entry and Exit range would indicate? The chart also shows no indications that the profit is higher than it should be.

Is there another setting I am neglecting somewhere?

thanks

You didn't say which symbol this was for ? and you need to confirm your Account currency is US $ ? OK so it was EURGBP, it would only be $60 profit for XXXAccountCurrency pairs such as EURUSD, take a look at the TICKVALUE value for EURGBP
 
RaptorUK:
You didn't say which symbol this was for ? and you need to confirm your Account currency is US $ ?


Symbol is EURGBP (I've included a print out above now, showing symbol).

Account was set up in usd, and below is the pic for the EA properties


 
RaptorUK:
You didn't say which symbol this was for ? and you need to confirm your Account currency is US $ ? OK so it was EURGBP, it would only be $60 profit for XXXAccountCurrency pairs such as EURUSD, take a look at the TICKVALUE value for EURGBP


Yep, you were correct. Tick value is below

I'll have to do some sort of conversion variable, so that I can enter in dollars and it will translate that to the correct pip TP and SL for any symbol

Thanks much!



P.S. that would also explain the bizarre covariance I was getting on TP/ SL parameter settings on different symbols, compared to other parameter settings . So two mysteries solved with one stone, a two fer.

 

So here's what I did for remedy:


     string sym =Symbol();// These 2 variables will be declared as global/static, and then called and filled once in init(). Or I could call them each bar to be more precise, either way works for me.
     double TickVal= MarketInfo(sym,MODE_TICKVALUE);  
   
     StopLoss  =(150/TickVal)* pips; 
     TakeProfit=(60/TickVal )* pips; 

     if(StopLoss==0)  bsl=0;// This section prevents calculation errors on ECN brokers or if no stop loss is set or no profit target is set.
       else bsl= (Ask-StopLoss);
     if(TakeProfit==0)  btp=0;
       else btp= (Ask+TakeProfit);
     if(StopLoss==0)  ssl=0;
       else ssl= (Bid+StopLoss);
     if(TakeProfit==0)  stp=0;
       else stp= (Bid-TakeProfit);  
 
moneycode:

So here's what I did for remedy:


Why adjust your SL and TP ? isn't it logical to keep your SL and TP where they should be according to your Strategy and instead adjust the position size ?
 
RaptorUK:

Why adjust your SL and TP ? isn't it logical to keep your SL and TP where they should be according to your Strategy and instead adjust the position size ?

You're right.

In fact the TICKVALUE will impact all price based indicators relation to intra-trade P/L increments. (if position sizing wasn't applied). And the same incremental slippage would skew all signal precision.

So it's a must do (if you want a standardized performance capabilities between various symbols). Thanks!

 

This was my solution to the original problem, which was lot size related.

double AdjustLotSize()             // Function Adjust's lot size for various pairs to maintain relative consistent stop $ values.
{
    if(FixedLots > 0.0)// when lot size is manually input as a constant. auto adjustment functionality below will be bypassed.
       return (FixedLots);

    double LotSize   = MarketInfo(sym, MODE_LOTSIZE);
    double TickSize  = MarketInfo(sym, MODE_TICKSIZE);
    double TickValue = MarketInfo(sym, MODE_TICKVALUE);
    double LotStep   = MarketInfo(sym, MODE_LOTSTEP);
    double MinLots   = MarketInfo(sym, MODE_MINLOT);
    double MaxLots   = MarketInfo(sym, MODE_MAXLOT);    
    double lots;
    double PipLoss =StopLoss/pips;//PipLoss = Stop loss distance, in pip count. It is not a dollar amount or percentage amount. StopLoss may be hard coded in Signal Logic section.

    if( AccountFreeMargin()>Principle * Leverage){    
      lots =((Principle*PercentToRisk)/(PipLoss*TickValue)) *(TickSize/pips );// When discretionary account principle is used. //StopLoss is set inside Corrx() or can use PipLoss external
      //lots = ((AccountFreeMargin() * PercentToRisk) / (PipLoss * TickValue))*(TickSize/pips);// when full account size is used.
    }
    else{ 
      Print("Account Free Margin amount of ",AccountFreeMargin()," is less than margin requirements. Verify your Leverage and Principle input amounts.");
      lots=0.0;
    }
    
    if(lots<MinLots || lots<LotStep){
      Print("lots size of ",lots,", is less than minumum allowed lot increments of ",LotStep," or minumum allowed lot size of ",MinLots);
      lots=0.0;
    }
    
    lots /= LotStep;
    lots = NormalizeDouble(lots, 0);
    lots *= LotStep;       
    if(lots>MaxLots) lots=MaxLots;


   return (lots);

}
 

Something else relative to this lot size issue, which I just discovered:

MODE_LOTSTEP returns different values depending on whether your mt4 platform is online or offline.

for example when running the tester offline over the weekend.

Online Oanda returns 0.01 LOTSTEP

Offline Oanda returns 0.10 LOTSTEP

I assume that is the only time the LOTSTEP would change. (though that is just my own speculation).

Running the tester offline could produce different performance results than online performance as a result of LOTSTEP changes,, and could theoretically therefore have also produced the same incorrectly appearing Profit results, that the original question of this thread presented.

Reason: