Edit Your Comment
Function that returns the number of consecutive wins
forex_trader_318221
Apr 07, 2016 부터 멤버
게시물32
forex_trader_25447
Dec 21, 2010 부터 멤버
게시물131
Aug 24, 2016 at 14:38
Dec 21, 2010 부터 멤버
게시물131
This program return numbers of winners (nWin)
from last accepted loss in current symbol :
// program global variable
double nWin;
void Profit() // Return nWin
{ datetime LastTimeLOSS=0;
j=0;
while ( j<OrdersHistoryTotal() )
{ if ( OrderSelect(j,SELECT_BY_POS,MODE_HISTORY) )
if ( OrderSymbol()==_Symbol )
if ( OrderType()==OP_BUY || OrderType()==OP_SELL )
{ if ( OrderCloseTime()>LastTimeLOSS && OrderProfit()<0.0 )
LastTimeLOSS=OrderCloseTime();
}
j++; }
if ( OrderSelect(0,SELECT_BY_POS,MODE_HISTORY) )
if ( LastTimeLOSS==0 ) LastTimeLOSS=OrderOpenTime();
else {}
else LastTimeLOSS=TimeCurrent();
j=0; CurrentPROFIT=0; nWin=0;
while ( j<OrdersHistoryTotal() )
{ if ( OrderSelect(j,SELECT_BY_POS,MODE_HISTORY) )
if ( OrderType()==OP_BUY || OrderType()==OP_SELL )
if ( ( OrderCloseTime()==LastTimeLOSS && OrderSymbol()!=_Symbol ) ||
OrderCloseTime()>LastTimeLOSS ) nWin++;
j++;
}
}
from last accepted loss in current symbol :
// program global variable
double nWin;
void Profit() // Return nWin
{ datetime LastTimeLOSS=0;
j=0;
while ( j<OrdersHistoryTotal() )
{ if ( OrderSelect(j,SELECT_BY_POS,MODE_HISTORY) )
if ( OrderSymbol()==_Symbol )
if ( OrderType()==OP_BUY || OrderType()==OP_SELL )
{ if ( OrderCloseTime()>LastTimeLOSS && OrderProfit()<0.0 )
LastTimeLOSS=OrderCloseTime();
}
j++; }
if ( OrderSelect(0,SELECT_BY_POS,MODE_HISTORY) )
if ( LastTimeLOSS==0 ) LastTimeLOSS=OrderOpenTime();
else {}
else LastTimeLOSS=TimeCurrent();
j=0; CurrentPROFIT=0; nWin=0;
while ( j<OrdersHistoryTotal() )
{ if ( OrderSelect(j,SELECT_BY_POS,MODE_HISTORY) )
if ( OrderType()==OP_BUY || OrderType()==OP_SELL )
if ( ( OrderCloseTime()==LastTimeLOSS && OrderSymbol()!=_Symbol ) ||
OrderCloseTime()>LastTimeLOSS ) nWin++;
j++;
}
}
*상업적 사용 및 스팸은 허용되지 않으며 계정이 해지될 수 있습니다.
팁: 이미지/유튜브 URL을 게시하면 게시물에 자동으로 삽입됩니다!
팁: @기호를 입력하여 이 토론에 참여하는 사용자 이름을 자동으로 완성합니다.