Hi I'm Having some problems with a formula, please help me out if you can:
I want to buy when pico1>pico2 AND Preco1<Preco2 is True. I used PlotShapes to determine if my formula was correct and it was as I expected. But when I use the same formula to Buy it, nothing happens on the Backtest, no stocks are bought. I can't undestand why...
pico1 = ValueWhen( Ref(HistMinCond,0), Ref(HistInd,-1), 1 );
pico2 = ValueWhen( Ref(HistMinCond,0), Ref(HistInd,-1), 2 );
Preco1 = ValueWhen( Ref(HistMinCond,0), L, 1 );
Preco2 = Preco1 = ValueWhen( Ref(HistMinCond,0), L, 2 );
PlotShapes( IIf( pico1>pico2 AND Preco1<Preco2,shapeSmallUpTriangle,shapeNone ),
colorGreen, 0, 0 , -12 );
Buy=pico1>pico2 AND Preco1<Preco2;
I want to buy when pico1>pico2 AND Preco1<Preco2 is True. I used PlotShapes to determine if my formula was correct and it was as I expected. But when I use the same formula to Buy it, nothing happens on the Backtest, no stocks are bought. I can't undestand why...
pico1 = ValueWhen( Ref(HistMinCond,0), Ref(HistInd,-1), 1 );
pico2 = ValueWhen( Ref(HistMinCond,0), Ref(HistInd,-1), 2 );
Preco1 = ValueWhen( Ref(HistMinCond,0), L, 1 );
Preco2 = Preco1 = ValueWhen( Ref(HistMinCond,0), L, 2 );
PlotShapes( IIf( pico1>pico2 AND Preco1<Preco2,shapeSmallUpTriangle,shapeNone ),
colorGreen, 0, 0 , -12 );
Buy=pico1>pico2 AND Preco1<Preco2;
Last edited: