David,
The IIF() function calculates each of its arguments before calculating its output, so your formula
IIf(Condition2, -1, Ref(MySignal,-1)
yields an array which consists of -1 at bars where condition2 is true and Null where it is false (except for bar 499 where you pre-assigned 0 to MySignal).
If you want to resolve conflicting signals and carry along the previous signal until it flips, you can try,
Filter = 1;
MySignal = 0; // No signals yet
AddColumn(MySignal, "Check Signals: Initiation");
Condition1=EMA(C,10) > EMA(C,20);
Condition2=EMA(C,20) < EMA(C,40);
ConflictResolve = ...<write your own logic>...
MySignal = IIF(Condition1 AND Condition2, ConflictResolve, MySignal);
AddColumn(MySignal, "Check Signals: Conflict Condition");
MySignal = IIF(Condition1 AND NOT Condition2, 1, MySignal);
AddColumn(MySignal, "Check Signals: Condition1 only");
MySignal = IIF(Condition2 AND NOT Condition1, -1, MySignal);
AddColumn(MySignal, "Check Signals: Condition2 only");
MySignal = ValueWhen(MySignal, MySignal, 2);
AddColumn(MySignal, "Check Signals: Wait For Flip");
---In amibroker@yahoogroups.com, <reinsley@...> wrote :
Hi,
I did not read the whole story.
Aron gave a snippet that may help.
https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/180017
Best regards
Hi,
I did not read the whole story.
Aron gave a snippet that may help.
https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/180017
Best regards
Le 22/01/2016 10:16, dpellon@... [amibroker] a écrit :
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: rosenberggregg@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (3) |
**** 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/
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