[amibroker] Is it possible to assign to an array the previous value?

 

Hello,

Let's imagine i have two very different ema crossovers and i want to make sure that i don't get conflicting values so i first check the buy and if not then i check sell, if not either then i want previous value of signal.

Why is not getting the array the previous value?




MySignal[499]=0;

Condition1=EMA(C,10) > EMA(C,20);
Condition2=EMA(C,20) < EMA(C,40);

MySignal=IIf(Condition1, 1, IIf(Condition2, -1, Ref(MySignal,-1)));

Buy = MySignal==1;
Sell=  MySignal==-1;


Thanks and Best regards,




__._,_.___

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