Hi,
If i want to buy every time the close price goes up 10%, then close out, and then sell short every time the close drops 10%. How should I code.
E.g. C1=8,
C2=9 (buy)
C3=10(buy)
Then sell at C4
Then when C5=10
C6=8 (Sell short)
C10=6(Sell short)
C12=4 (Sell short)
My buy/sell short conditon is based on the previous buy/sell short price.
I have asked similar questions about it before. First of all, Thank you for replying.
I saw some people have this kind of backward reference questions as well, and GV.dll or latch or prev/valuewhen are advised. But I am still not quite understand how to use GV.dll and latch.
I have work out the formula for buy conditon, and it is fine to me:
var1:=valuewhen(1,C*0.9>prev, C);
var2:=valuewhen(2,C*0.9>prev, C);
Cross(var1,var2*1.1)
But, when I use the similar idea in sell short. It doesnt work.
I am still new to MS, so if you have a better solution for this, please help me with this. Thanks.