zoop Posted February 24, 2010 Report Posted February 24, 2010 how would i write this simple code? close all orders on candle color change if((redcandle))closebuy(); if((greencandle))closesell(); much thanks
⭐ birt Posted February 24, 2010 Report Posted February 24, 2010 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now