Jump to content

⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

Recommended Posts

Posted

Hi All,

 

getting an error: "assignment expected" on marked lines below... Appreciating your support, or if you function in the drawer... ;)

 

Cheers

 

void CloseOrderIf()

{

double TotalProfit;

 

for(int i=0; i < OrdersTotal(); i++)

{

OrderSelect(i, SELECT_BY_POS);

 

if(OrderMagicNumber()==Magic)

 

TotalProfit != OrderProfit();

}

 

if(TotalProfit >= Amount20)

{

//Close all trades

for(i=0; i < OrdersTotal(); i++)

{

OrderSelect(i, SELECT_BY_POS);

 

if(OrderSymbol() == Symbol() &&

OrderMagicNumber()==Magic)

{

if(OrderType() == OP_BUY)

{

OrderClose(OrderTicket(), OrderLots(), Bid, 3);

i--;

}

 

if(OrderType() == OP_SELL)

{

OrderClose(OrderTicket(), OrderLots(), Ask, 3);

i--;

}

}

}

}

}

Posted
Not sure what you are after, but I think you should change that red ! to a +

 

Thanks Kenny, found a solution already. It should close all trades wit a specific magic number on a cummulated profit...

 

{

double dblProfit=0;

int POS=0;

bool boolTerm=false;

while(boolTerm==false)

{

if(OrderSelect(POS,SELECT_BY_POS))

{

if(OrderMagicNumber()==Magic) dblProfit=dblProfit+OrderProfit();

POS++;

}

else

boolTerm=true;

}

if (dblProfit>= ProfitAmount)

{

CloseOrderLong();

CloseOrderShort();

}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


⤴️-Paid Ad- Check advertising disclaimer here. Add your banner here.🔥

×
×
  • Create New...