I have a nervous line and if a short event occurs the it should be saved. For the next round.The countertrade should reset this. Vise Versa.I did this with statichvar and it works so far. I Test it with
paramtrigger Signal by hand. If i use the Trading Rule, it will not work. I try Lastvalue() and IIF but without success. Is there a way to do this better?.
If anyone can help, I would be grateful for that.
Regard DB
Her my Test Snipe:
WMA_1=WMA(C,4);
WMA_2=WMA(C,8);
WMA_3=WMA(C,20);
Plot(WMA_1,"",colorwhite,styleline);//4
Plot(WMA_2,"",colorred,styleline);//8
Plot(WMA_3,"",colorgreen,styleline);//12
Buy_Trig_P=ParamTrigger("Test_Buy","Test_Buy"); // For Debug
Sell_Trig_P=ParamTrigger("Test_Sell","Test_Sell");// For Debug
/*--------------------Tade Rule ----------------------------*/
Buy_sig =Cross (WMA_1,WMA_2) AND Cross (WMA_2,WMA_3) OR Buy_Trig_P;
Sell_sig =Cross (WMA_2,WMA_1) AND Cross (WMA_3,WMA_2) OR Sell_Trig_P;
//................................................
if(LastValue(Buy_sig)) {StaticVarSet("Buy_status",1);StaticVarSet("Sell_status",0);}
Buy_sig = StaticVarGet("Buy_status");
//................................................
if(LastValue(Sell_sig)) {StaticVarSet("Buy_status",0) ;StaticVarSet("Sell_status",1);}
Sell_sig = StaticVarGet("Sell_status");
//...........Transfer Tadesig to Buy/Sell .........
Buy = flip(Buy_sig , Sell_sig );
Sell = flip(Sell_sig, buy_sig );
//printf("Buy_Trig = "+Buy_Trig+"\n"+"Sell_Trig = "+Sell_Trig+"\n"+"\n");
printf("Buy_sig = "+Buy_sig+"\n"+"Sell_sig = "+Sell_sig+"\n"+"\n");
printf("Buy = "+Buy+"\n"+"Sell = "+Sell+"\n");
//...............................................................ENDE