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

 
[Attachment(s) from kastinhelia@yahoo.com.au [amibroker] included below]

i'm not the best at coding, i'm sure there are easier way to do it but is this what your after?


the100a = Optimize("the100",100,20,100,20);
the100 = MA(C,the100a);
the5a = Optimize("the5",5,2,10,1);// 10
the5 = MA(C,the5a);
//Plot( MA( Close, the5a ), "Fast Avg", ParamColor( "Color-Fast", colororange ), styleDashed ); 
//Plot( MA( Close, the100a ), "Fast Avg", ParamColor( "Color-Fast", colororange ), stylethick ); 

diff = 1.001;

Buy = 0;
Sell = 0;


lastbuyprice = ValueWhen(Buy,BuyPrice,1);
lastsellprice = ValueWhen(sell,sellPrice,1);

buycond1 = Cross(the5,the100);
buycond2 = C < (lastsellprice*diff);

sellcond1 = Cross(the100,the5);
sellcond2 = C > (lastbuyprice*(1-diff));

Buy = buycond1 OR buycond2;
Sell = sellcond1 OR sellcond2;


Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(IIf(buy,shapeupArrow, shapeNone), colorgreen, 0, L, -60);
PlotShapes(IIf(sell,shapesmallcircle,shapeNone), colorred, 0, L, 60);

__._,_.___

Attachment(s) from kastinhelia@yahoo.com.au [amibroker] | View attachments on the web

1 of 1 File(s)


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


.

__,_._,___

Related Posts


EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv