
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
extern in StopLoss=20;
extern TakeProfit=100;
int i, Total;
double Profit, Lots, Ticket;// Do you see where I have put these ones and defined them?? I have made them global variables, out of start() function!!!!!!!!!!!!!!!!!!!
start(){
Trade(); Do you see this function reference???????????????????
Total=OrdersTotal();
for(i=Total-1; i>=0; i--)// here we are referring to the most recently opened trade
if( OrderSelect(i, SELECT_BY_POS, MODE_TRADES)==True && OrderSymbol()==Symbol()){
Profit=OrderProfit(); Lots=OrderLots(); Ticket=OrderTicket();// Do you see where they are now???????????????????????????????
}
}
//=========================================Trade Function=================================//
int Trade(){
//What do you want to do with that trade??
if(Profit>0)//MEANS THE TRADE IS PROFITABLE; ok lets close it as an example
{
OrderClose(OrderSymbol(), Ticket,.........);
}
}
//====================================================================================//