zoop Posted February 24, 2010 Report Share 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 Quote Link to comment Share on other sites More sharing options...
⭐ birt Posted February 24, 2010 Report Share 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.