[amibroker] Re: Is there any way to get the last signal (buy or sell) and the last order price?

 

Thanks a lot for your reply.

I want to create a trading system that not only uses close, open etc but also get some valuable information from previous trades.

Something like the very simple example below: An EMA crossover but maybe also selling or buying depending on some logic regarding at what price we performed the previous trade.

In the case below i am performing buy and trade orders depending of an ema crossover but (an example) when the actual close is below a 1% from previous my previous sell.

At the moment i am unable to get on TRACE or even on Debug the LastBuyPrice or LastSellPrice. So i think the LastSellPrice and LastBuyPrice are not working.


Thanks again,


-------------------------------------------------------------------------------------------------
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);
-------------------------------------------------------------------------------------------------

__._,_.___

Posted by: dpellon@gmail.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)
**** 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/


.

__,_._,___


EmoticonEmoticon