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
In this code I want to test what the values are for the Orderprofit but "OrderOpenPrice() - OrderClosePrice()" just shows 0, why?, isn´t these values not avalible in the demo version or what? (The code below is just a simple code with 3 seconds between OrderSend and OrderClose to illustrate the problem). Could someone please give me a hint?
-----------------------------------------------------------------------
#define MAGICMA 20050610
int start()
{
int res; datetime currenttime; double orderprofit;
Sleep(3000);
if (OrdersTotal()==0) res=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"",MAGICMA,0,Blue);
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
OrderModify(OrderTicket(),OrderOpenPrice(),Ask-(200*Point),Ask+(200*Point),0,CLR_NONE);
Sleep(3000);
OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
OrderSelect(0,SELECT_BY_POS,MODE_HISTORY);
currenttime=TimeCurrent();
orderprofit=(OrderOpenPrice() - OrderClosePrice()); //<<<<<<<<<<<<<PROBLEM<<<<<<<<<<<<<<
Print("Profit= ", orderprofit);
Print("TimeClose= ", TimeToStr(OrderCloseTime(),TIME_DATE|TIME_MINUTES), " Current time= ", TimeToStr(currenttime,TIME_DATE|TIME_MINUTES), " Current time + 30 minutes= ", TimeToStr (currenttime+1800,TIME_DATE|TIME_MINUTES));
return(0);
}
-------------------------------------------------------------------