Jump to content

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

Recommended Posts

Posted

how would i write this simple code?

 

 

close all orders on candle color change

 

if((redcandle))closebuy();

if((greencandle))closesell();

 

much thanks

Posted

Re: (ASK) close all on candle color change

 

how would i write this simple code?

 

 

close all orders on candle color change

 

if((redcandle))closebuy();

if((greencandle))closesell();

 

much thanks

 

if (Close[1] < Open[1]) CloseBuy(); // previous bar closed below its open
if (Close[1] > Open[1]) CloseSell(); // previous bar closed above its open

 

If you need to write closebuy() and closesell() yourself, just loop through the orders from OrdersTotal()-1 to 0, selectively closing OP_SELL and OP_BUY. There's a lot of examples, you can find them in pretty much any EA.

 

It's a good idea to only run that code on a new bar to prevent closing any newly open orders that go "against" the previous bar.

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...