Hi Wegi, thanks for the idea.
Looked in wiki for more information about the i_setplotvalue but it's not clear where to put this in the signal and indicator.
I tried to put i_setplotvalue(1,Marketposition) as a variable but got: syntax error, unexpected 'identificator, expecting 'data' or 'data'.
First code is the signal, the second is the indicator. With this I got no errors but it's not really what it should be.
It's the Marketposition that I have to get into the indicator, isn't?
Code: Select all
Inputs:
LE_Lookback(100),
LX_Lookback(100),
SE_Lookback(100),
SX_Lookback(100),
StrategyName("SP");
Variables:
le(false),lx(false),
se(false),sx(false),
i_setplotvalue(1);
le = Close > Highest(Close,LE_Lookback)[1];
lx = Close < Lowest(Close,LX_Lookback)[1] ;
se = Close < Lowest(Close,SE_Lookback)[1] ;
sx = Close > Highest(Close,SX_Lookback)[1];
if MarketPosition = 0 then begin
if le and not lx and not se then begin
buy ("Long") next bar open;
end;
if se and sx = false and le = false then begin
sellshort ("Short") next bar open;
end;
end
else if MarketPosition = 1 then begin
if lx then begin
if se then begin
sellshort ("Short ") next bar open;
end;
end;
if lx then begin
sell ("LX") next bar open;
end;
end
else if MarketPosition = -1 then begin
if sx then begin
if le then begin
buy ("Long ") next bar open;
end;
end;
if sx then begin
buytocover ("SX") next bar open;
end;
end;
----------------------------------
Code: Select all
Variables:
lowestClose(0), x(0),
i_getplotvalue(1) ;
if i_getplotvalue = 1 then begin
lowestClose = Lowest(Close, 100)[1];
// Remove the old plot
for x = 0 to 10 begin
NoPlot[x](1);
end;
// Plot the new plot
for x = 0 to 9 begin
Plot1[x](lowestClose, "LowestClose");
end;
end;