Hi,
Did you see *gapup() and **gapdown()* ? And associated formulas into AB library... http://www.amibroker.com/guide/afl/afl_view.php?id=58 Best regards Le 09/07/2010 20:58, chuck_win a écrit :
I want to find the open gaps. I use 30m bar. I check price at 9:30am very day. if open price > yesterday's close * 1.10, buy at yesterday close price and sell at open price at 9:30am.my code below doesn't work. Thanks very much to any assistance. Charles Perc = Optimize("Perc", 10, 3, 10, 1); //=============================================== buy rules Buyrule1 = TimeNum() == 93000 AND Open > Ref(Close, -1) * (1 + Perc/100); //=============================================== sell rules Sellrule1 = TimeNum() == 93000; //=============================================== trade Sell = 0; Buy = Buyrule1; BuyPrice = Ref(Close, -1); Sell = Sellrule1; SellPrice = Open; // Remove excess signals Buy = ExRem(Buy, Sell); // Remove additional signals, Sell = ExRem(Sell, Buy);
