Hi All,
Anyone can provide the example code for :
1) calculate the total Profit as Points Not currency?
Thanks in advance:)
- How to calculate total Lots and total profit as points? Attn: Roger and Ais Pls help?
- Hi Rosh, Please help!
- Can anyone provide the coding of live charting?
int pips; double pip; for(int b=0;b<OrdersHistoryTotal();b++) { OrderSelect(b,SELECT_BY_POS,MODE_HISTORY); pip=0; if(MarketInfo(OrderSymbol(),MODE_POINT)>0&&OrderType()==0)pip=NormalizeDouble(OrderClosePrice()-OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_DIGITS))/MarketInfo(OrderSymbol(),MODE_POINT); if(MarketInfo(OrderSymbol(),MODE_POINT)>0&&OrderType()==1)pip=-NormalizeDouble(OrderClosePrice()-OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_DIGITS))/MarketInfo(OrderSymbol(),MODE_POINT); if(pip!=0)pips+=NormalizeDouble(pip,0); } Print("I earned - ",pips," pips!");
A Sample: Value to points conversion:
int init () //< 1> { //< 2> string acs.Operation [] = { "Buy" , "Sell" } ; //< 3> //< 4> double avd.QuotePoint = MarketInfo ( Symbol () , MODE_POINT ) ; //< 5> double avd.QuoteTick = MarketInfo ( Symbol () , MODE_TICKSIZE ) ; //< 6> double avd.NominalTick = MarketInfo ( Symbol () , MODE_TICKVALUE ) ; //< 7> double ald.NominalPoint = avd.NominalTick * avd.QuotePoint / avd.QuoteTick ; //< 8> //< 9> Alert ( "" ) ; //< 10> Alert ( "avd.QuotePoint: " , DoubleToStr ( avd.QuotePoint , Digits ) ) ; //< 11> Alert ( "avd.QuoteTick: " , DoubleToStr ( avd.QuoteTick , Digits ) ) ; //< 12> Alert ( "avd.NominalTick: " , DoubleToStr ( avd.NominalTick , 2 ) ) ; //< 13> Alert ( "ald.NominalPoint: " , DoubleToStr ( ald.NominalPoint , 2 ) ) ; //< 14> //< 15> if ( OrdersTotal () > 0 ) //< 16> { int i , N ; N = OrdersTotal () - 1 ; //< 17> for ( i = N ; i >= 0 ; i -- ) //< 18> { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //< 19> //< 20> double ald.OrderProfit = OrderProfit () ; //< 21> double ald.ContractSize = OrderLots () ; //< 22> double ald.OrderPoint = ald.NominalPoint * ald.ContractSize ; //< 23> int ali.OrderProfit = MathRound ( ald.OrderProfit / ald.OrderPoint ) ; //< 24> //< 25> Alert ( "" ) ; //< 26> //< 27> Alert ( "Profit, points: " , ali.OrderProfit ) ; //< 28> //< 29> Alert ( "Profit, " , AccountCurrency () , //< 30> " : " , DoubleToStr ( ald.OrderProfit , 2 ) ) ; //< 31> //< 32> Alert ( "Order Point, " , AccountCurrency () , //< 33> " : " , DoubleToStr ( ald.OrderPoint , 2 ) ) ; //< 34> //< 35> Alert ( "Size, lots: " , DoubleToStr ( ald.ContractSize , 2 ) ) ; //< 36> Alert ( "Type: " , acs.Operation [ OrderType () ] ) ; //< 37> Alert ( "Ticket: #" , OrderTicket () ) ; //< 38> //< 39> } // for //< 40> } // if //< 41> } //< 42>

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register