Thanks for your reply. I still don't get it.
I think the problem might be that i am confusing things.
If i want to use the the last price from the trading system i am working on. Do i need to create a backtest object for my system and get the previous signal and have that running on every optimization step?
For example. In something like this the TRACE will never give the BuyPrice or the SellPrice and i don't understand why because the system is giving hundreds of buys and sells.
-------------------------------------------------------------------------------------------------
OptimizerSetEngine("cmae");
P1=Optimize("P1", 2,2,100,1);
P2=Optimize("P2", 4,2,100,1);
Diff=1.001
Buy=Null; #
Sell=Null;
LastBuyPrice=ValueWhen(Buy, BuyPrice,1) ;
LastSellPrice=ValueWhen(Sell, SellPrice,1) ;
_TRACE("LastBuyPrice="+LastBuyPrice+" | LastSellPrice="+LastSellPrice);
Buy=EMA(C,P1)>EMA(C,P2) or C < LastSellPrice * Diff;
Sell=EMA(C,P1)<EMA(C,P2) or C > LastBuyPrice * (1-Diff);
-------------------------------------------------------------------------------------------------
The Log Window always shows (optimizing or backtesting):
LastBuyPrice=0 | LastSellPrice=0 Formulas\Custom\Formula 2.afl 15 70 07:19:59.74
LastBuyPrice=0 | LastSellPrice=0 Formulas\Custom\Formula 2.afl 15 70 07:19:59.78
LastBuyPrice=0 | LastSellPrice=0 Formulas\Custom\Formula 2.afl 15 70 07:19:59.81
LastBuyPrice=0 | LastSellPrice=0 Formulas\Custom\Formula 2.afl 15 70 07:19:59.85
LastBuyPrice=0 | LastSellPrice=0 Formulas\Custom\Formula 2.afl 15 70 07:19:59.88
Posted by: dpellon@gmail.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (3) |
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/
EmoticonEmoticon