View Single Post
  #13 (permalink)  
Old 05-30-2006, 01:18 PM
gbolla gbolla is offline
Senior Member
 
Join Date: May 2006
Posts: 128
gbolla is on a distinguished road
Hi Igorad how are you?
I nedd your help again.
You translate this part of Easy Language...

if (PositionProfit(1)<0 and PositionProfit(2)<0) then
contr_plus=1;
else contr_plus=0;

...with....

PastTradeProfit();

if ((pastpips[1]+pastpips[2]) < 0 && (pastpips[3]+pastpips[4]) < 0)
{
contr_plus = 1;
}
else
{
contr_plus = 0;
}

...and....

void PastTradeProfit()
{
int total=HistoryTotal(), n=0;
ArrayResize(pastpips,total);
for (int cnt=total-1;cnt>=0;cnt--)
{
if ( OrderSymbol()==Symbol())
{
if (!OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY) && OrderType() > OP_SELL ) continue;

if (OrderType()==OP_BUY)
{n = n+1;
pastpips[n] = MathRound((OrderClosePrice()-OrderOpenPrice())/MarketInfo(Symbol(),MODE_POINT));}

if (OrderType()==OP_SELL)
{n = n+1;
pastpips[n] = MathRound((OrderOpenPrice()-OrderClosePrice())/MarketInfo(Symbol(),MODE_POINT));}
}
}
}
.... in MT4.

But PositionProfit(1) means the yesterday profit and PositionProfit(2) the before yesterday profit. Instead with your MT4 code, there is contr_plus=1 when I have 2 consecutive negative profit trades and not when I have 2 consecutive negative profit days.
Can you change the MT4 code for this purpose?
Thanks

Bolla
Reply With Quote