Ahhh... thx H
d On Sun, Apr 26, 2009 at 2:16 PM, Herman <[email protected]> wrote: > > > The -AT forum is now owned by AmiBroker. > > > best regards, > > herman > > > > Sunday, April 26, 2009, 1:52:25 PM, you wrote: > > > > > > > > > Herman does, or a least used to. He may be traveling... > > > > d > > > On Sun, Apr 26, 2009 at 12:52 PM, shakerlr <[email protected]> wrote: > > > Hi Keith...Just wondering, if this autotrading forum for Amibroker is > alive? I've tried to get access for the past week, but no one replies to my > emails or subscription requests...Anyone know who controls the board? > > > > --- In [email protected], "shakerlr" <ljr...@...> wrote: > > > > > > Thanks Keith. I did not know about that other forum! > > > > > > --- In [email protected], Keith McCombs <kmccombs@> wrote: > > > > > > > > eToke and shakerlr -- > > > > Two very good posts. > > > > I notice that both of you are relatively new to this forum. You might > > > > not know that their is another yahoogroups forum, amibroker-at, that > > > > deals specifically with autotrading. Your posts may get a lot more > > > > attention there. In fact, I would suggest that you repost them there. > > > > -- Keith > > > > > > > > etoketrader wrote: > > > > > > > > > > > > > > > Hi, > > > > > > > > > > With realtime trading you need to think a little differently then if > > > > > you were backtesting: It is quite likely that your AFL code will be > > > > > run multiple times during the same bar. If you are running it from a > > > > > chart, then the code will be run every time this is refreshed - this > > > > > could be many times per second. Check your intraday settings in > > > > > preferences for this. I myself run my systems from the Analysis > > > > > window: The frequency is much less, but it may run several times for > > > > > the same bar nonetheless. > > > > > > > > > > It is important to understand that if a signal is true on the bar, > > > > > then it is true every time the AFL is run, so multiple signals are > > > > > only natural and need to be taken into consideration. > > > > > > > > > > Also you must be prepared for inaccuracies as you will never be able > > > > > to exactly match an event such as the open of a new bar in your real > > > > > time trading. The more liquid the instrument, the better it will be. > > > > > > > > > > A) You must address multiple buy/sell signals by checking whether you > > > > > already have an open position. Alternatively, use static variables so > > > > > that you do not repeat an order while on the same bar. You can then > > > > > reset the variable by detecting a change of bar. > > > > > > > > > > B) If you want to attempt to get as close as possible to the open of > > > > > the next bar, then what I suggest you do is to store your order > > > > > signals into static variables when they occur (anytime in the current > > > > > bar). Then, in your IB order logic, detect the change of bar to fire > > > > > the orders and reset these order static variables. I find this to be > > > > > virtually impossible to acheive using AA window for autotrading. I > > > > > personally resolve this problem by using the smallest timeframe > > > > > possible on the AA Window and let the trade happen at any point > during > > > > > the bar where the signal occurs. For backtesting I take an average of > > > > > the bar as my price. I find this inaccuracy to be almost irrelevant > > > > > when compared to other forms of slippage. > > > > > > > > > > I suggest you refer to the Amibroker User Knowledge Base: > > > > > http://www.amibroker.org/userkb/ <http://www.amibroker.org/userkb/> > > > > > which has a lot of valuable information on the subject. > > > > > > > > > > As regards to detecting the change of bar, I did not have the time to > > > > > find this code for you but I have several instances of it on this > > > > > knowledgebase and/or in other posts. > > > > > > > > > > eToke > > > > > > > > > > > > > > > --- In [email protected] > > > > <mailto:amibroker%40yahoogroups.com<amibroker%2540yahoogroups.com> > >, > > > > > "shakerlr" <ljr500@> wrote: > > > > > > > > > > > > After posting this message: > > > > > > http://finance.groups.yahoo.com/group/amibroker/message/137490 > > > > > <http://finance.groups.yahoo.com/group/amibroker/message/137490> > > > > > > > > > > > > Which brings up a point on signals on the current bar in real time. > > > > > Namely, they may occur many times until that bar is finally > > > > > written/printed. I tried my strategy with the bar replay tool and > > > > > found that I indeed was generating multiple signals to the (IB) > > > > > auto-trader. > > > > > > > > > > > > I tried users/Thomas' suggestion of using > > > > > > buy=ref(buy, -1), but I still get multiple signals. > > > > > > > > > > > > http://finance.groups.yahoo.com/group/amibroker/message/132762 > > > > > <http://finance.groups.yahoo.com/group/amibroker/message/132762> > > > > > > http://finance.groups.yahoo.com/group/amibroker/message/132761 > > > > > <http://finance.groups.yahoo.com/group/amibroker/message/132761> > > > > > > > > > > > > Is there something else that I am missing to make the buy on prev > > > > > bar work. All I REALLY want to do is have a signal generated on the > > > > > current bar, and then act (open a trade) on that signal on the NEXT > > > > > bar open. Basically simulating the settradedelay(1,1,1,1) function, > > > > > but with real trading. > > > > > > > > > > > > here is my code below...you will see multiple traces showing > > > > > multiple buy signals. Note that useIB is false so AT is turned off. > > > > > > > > > > > > useIB=0; > > > > > > > > > > > > starttime=TimeNum() >= 094500 AND TimeNum() <=154500; > > > > > > test=0; > > > > > > Minprice=5; > > > > > > PositionSize = -20; // use minuse for -xx% of equity > > > > > > > > > > > > if (useIB) > > > > > > { > > > > > > ibc = GetTradingInterface("IB"); > > > > > > } > > > > > > > > > > > > //delay=Optimize("tradeDelay", 1, 1, 1, 1); > > > > > > //SetTradeDelays(delay, delay, delay, delay); > > > > > > > > > > > > Buy = Cross((Close),(EMA(Close,9))); > > > > > > > > > > > > // this should delay the signal for the next bar - right? > > > > > > Buy=Ref(Buy, -1); > > > > > > > > > > > > Buystop = Ref(EMA(Close,9),-1); > > > > > > BuyPrice = Max(Buystop,Low); > > > > > > > > > > > > // not worried about delaying the sell signal until I get the buy > > > > > signal working > > > > > > Sell = Cross(EMA(Close,9),(Close)); > > > > > > Sellstop = Ref(EMA(Close,9),-1); > > > > > > SellPrice = Min(sellstop,High); > > > > > > > > > > > > Buy = ExRem(Buy,Sell); > > > > > > Sell = ExRem(Sell,Buy); > > > > > > > > > > > > if (LastValue(Buy)) > > > > > > { > > > > > > _TRACE("BUYprice: " + BuyPrice + ", time=" + TimeNum()); > > > > > > > > > > > > if (useIB) > > > > > > { > > > > > > ibc = GetTradingInterface("IB"); > > > > > > > > > > > > // check if we are connected OK > > > > > > if( ibc.IsConnected() ) > > > > > > { > > > > > > // check if we do not have already open position on this stock > > > > > > if( ibc.GetPositionSize( Name() ) == 0 ) > > > > > > { > > > > > > // transmit order > > > > > > ibc.PlaceOrder( Name(), "Buy", 10, "MKT", 0, 0, "Day", True ); > > > > > > } > > > > > > } > > > > > > } > > > > > > } > > > > > > > > > > > > if (LastValue(Sell)) > > > > > > { > > > > > > _TRACE("Sellprice: " + SellPrice + ", time=" + TimeNum()); > > > > > > > > > > > > if (useIB) > > > > > > { > > > > > > ibc = GetTradingInterface("IB"); > > > > > > > > > > > > // check if we are connected OK > > > > > > if( ibc.IsConnected() ) > > > > > > { > > > > > > // need to have open position > > > > > > if( ibc.GetPositionSize( Name() ) > 0 ) > > > > > > { > > > > > > // transmit order > > > > > > ibc.PlaceOrder( Name(), "Sell", 10, "MKT", 0, 0, "Day", True ); > > > > > > > > > > > > StaticVarSet(Name(), 0); > > > > > > } > > > > > > } > > > > > > } > > > > > > } > > > > > > > > > > > > shape = Buy * shapeUpArrow + Sell * shapeDownArrow; > > > > > > PlotShapes( shape, IIf( Buy, colorBlue, colorRed ), 0, IIf( Buy, > > > > > Low, High ) ); > > > > > > PlotShapes(IIf(Buy ==1, shapeUpArrow,shapeNone),colorBlue,0,0,10); > > > > > > PlotShapes(IIf(Sell ==1, > shapeHollowUpArrow,shapeNone),colorRed,0,0,10); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------ > > > **** IMPORTANT PLEASE READ **** > > This group is for the discussion between users only. > > This is *NOT* technical support channel. > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > SUPPORT {at} amibroker.com > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > http://www.amibroker.com/feedback/ > > (submissions sent via other channels won't be considered) > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > Yahoo! Groups Links > > > http://groups.yahoo.com/group/amibroker/ > > > Individual Email | Traditional > > > http://groups.yahoo.com/group/amibroker/join > > (Yahoo! ID required) > > > mailto:[email protected] > > mailto:[email protected] > > > [email protected] > > > http://docs.yahoo.com/info/terms/ > > > > > > > > > >
