raw buy signal troubles

#1
dear all,

I'm experiencing troubles with raw buy signals: when I ask for some buy bar info, e. g.:
buyclose = ValueWhen(Buy, C);
it happens that result refers to the last buy signals without taking in account if it is a raw signal or an actual trade.

here below an example:
SetBacktestMode( backtestRegular);
Buy = cross(C, MA(H, 10));
Sell = cross(MA(L,10), C);
buyvalue= ValueWhen(Buy, C);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);


In the figure below, the light green arrow is the actual Buy, the darkgreen arrow a raw Buy Signal. You can see that the 'Close when Buy' line (yellow line) changes after the raw Buy Signal.

thank you
cippo
 

Attachments

Last edited:

casoni

Well-Known Member
#2
hope you are looking for this type of setup

Buy = cross(C, MA(H, 10));
Sell = cross(MA(L,10), C);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

buyvalue= ValueWhen(Buy, C);
 
#3
Yess!
Thank you, Casoni, I had tried it but cause my messy trading system, I didnt understand it was the solution!

thank you

Cippos
 

Similar threads