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
any body able to assist fixing the compile errors in the code below
//+------------------------------------------------------------------+
//| defines |
//+------------------------------------------------------------------+
// #define MacrosHello "Hello, world!"
// #define MacrosYear 2005
//+------------------------------------------------------------------+
//| DLL imports |
//+------------------------------------------------------------------+
// #import "user32.dll"
// int SendMessageA(int hWnd,int Msg,int wParam,int lParam);
// #import "my_expert.dll"
// int ExpertRecalculate(int wParam,int lParam);
// #import
//+------------------------------------------------------------------+
//| EX4 imports |
//+------------------------------------------------------------------+
// #import "stdlib.ex4"
// string ErrorDescription(int error_code);
// #import
//+------------------------------------------------------------------+
void trail2(int ticket,int t1=150,int t2=80, int t3=150, int t4=80)
{
double sl;
double minpts;
if(!OrderSelect(ticket,SELECT_BY_TICKET)) return;
if(OrderCloseTime()!=0) return;
//get basic info
double oPrice,oStop,oTake,oTicket;
oPrice=OrderOpenPrice();
oStop=OrderStopLoss();
oTake=OrderTakeProfit();
oTicket=OrderTicket();
minpts=StopPoint();
if(OrderType()==OP_BUY)
{
if(oStop<oPrice () oStop==0)
{
if(Bid-oPrice>pts(t1))
{
sl=oPrice+pts(t2);
}
if(sl-oPrice>minpts && Bid-sl>minpts)
{
ModifySL(oTicket,sl);
}
}
//trailing
if(oStop>oPrice)
{
if(Bid-oStop>pts(t3))
{
sl=oStop+pts(t4);
}
if(sl-oStop>minpts && Bid-sl>minpts)
{
ModifySL(oTicket,sl);
}
}
}
if(OrderType()==OP_SELL)
{
if(oStop>oPrice () oStop==0)
{
if(oPrice-Ask>pts(t1))
{
sl=oPrice-pts(t2);
}
if(oPrice-sl>minpts && sl-Ask>minpts)
{
ModifySL(oTicket,sl);
}
}
//trailing
if(oStop<oPrice)
{
if(oStop-Ask>pts(t3))
{
sl=oStop-pts(t4);
}
if(oStop-sl>minpts && sl-Ask>minpts)
{
ModifySL(oTicket,sl);
}
}
}