How to code? - page 178

 
 
xBweNx:
this trailing script doesn't want to work correctly with me. I closes order right when i open it or doesnt place and close the trade correctly. Can someone take a look at it? that or is there another script(not ea) that you can use a trendline as the stoploss line so its hidden from your broker?

Try this

https://www.mql5.com/en/forum/177583/page34

 

thanks roger! ill give this one a try hopefully it will work the way i want it to

 

i dont know why but it seem like this scrip closes my traded also. atleast just the first one i put in for the pair than if i apply the script again it works fine?

 
xBweNx:
i dont know why but it seem like this scrip closes my traded also. atleast just the first one i put in for the pair than if i apply the script again it works fine?

Who is your broker? I will try. I've never had this problem.

 

my broker is alpari

 
xBweNx:
my broker is alpari

Did you put it in Scripts directory?

 
Roger09:
Did you put it in Scripts directory?

yes i did. it apply to the chart but it will close it right when i apply it. if i open up another trade than it does not close out the trade.

 

invalid integer number

Hello,

I have this code

int ticket1;

ticket1 = OrderSend(symbol1, OP_BUY, LotSize, Ask, Slippage, 0, 0, 0,"Hedge Difference EA",Magicnumber,0);

if (ticket1 <0 )

{

Print ("OrderSend failed with error #", GetLastError());

return(0);

}

int ticket2;

ticket2 = OrderSend(symbol2, OP_BUY, LotSize, Ask, Slippage, 0, 0, 0,"Hedge Difference EA",Magicnumber,0);

if (ticket2 <0 )

{

Print ("OrderSend failed with error #", GetLastError());

return(0);

}

EA is not attached to the same chart. It sends only 1 order on the chart it is attached to. I want it to send the other order also, that it is not attached to.

It gives error invalid integer number as parameter 9 for ordersend function.

Thanks

 
xBweNx:
yes i did. it apply to the chart but it will close it right when i apply it. if i open up another trade than it does not close out the trade.

I tryed several times on Alpari account, no mistakes. Just once, when I put script in experts directory and launch as EA.

It's because I asked you about directories.

Sorry.

Reason: