Fort Lauderdale
Posts: 1 since Oct 2013
Thanks Given: 0
Thanks Received: 0
|
Hi guys,
I have been working on this strategy for a few days now. It is pretty straight forward.
It is just a moving average crossover, with a RSI filter. PLA is just a special moving average
Just buy when PLAFast is above PLASlow, and RSI is above 60
Close buy when PLAFast closes below PLASlow
Short when PLAFast is below PLASlow , and RSI is below 40
close short when PLASlow closes above PLAFast .
I have a series of if statements, but I must be doing something wrong. It just chooses the first short statement, and nothing else happens.
Any Suggestions? I am totally stuck.
Inputs:
price(close),
PLAf(10),
PLAs(100),
RSILength(14),
RSIstrengthBuy(60),
RSIstrengthSell(40),
BuyDelta(0.00),
SellDelta(0.00),
antirev_on(false),
antirev_per(.25),
StopLossPoints(1000);
Variables:
pla1(0.0), pla2(0.0), RSIValue(0.0);
pla1= pla_pw(price,PLAf,antirev_on,antirev_per);
pla2= pla_pw(price,PLAs,antirev_on,antirev_per);
RSIValue=RSI(close, RSILength);
//gets pla fast and slow
{long 1 contracts at price if PLAf is above PLAs}
if CurrentBar > 1 and pla1 > pla2 and RSIValue > RSIstrengthBuy and marketposition = 0 then begin
Alert( "Fast PLA Crossover, RSI Stable" ) ;
Buy ( "PLA Crossover" ) 1 contracts next bar at (price) limit;
{Sets the stop loss in dallars}
SetDollarTrailing(StopLossPoints);
end;
If CurrentBar > 1 and pla1 < pla2 and marketposition = 1 then begin
Sell ("PLA Long Close") from entry("PLA Crossover") 1 contracts next bar at market;
end;
{short 1 contracts at price -BuyDelta if PLAf is below PLAs}
if CurrentBar > 1 and pla1 < pla2 and RSIValue < RSIstrengthSell and marketposition = 0 then begin
Alert( "Fast PLA Crossover, RSI Stable" ) ;
Sell Short ( "PLA Crossunder" ) 1 contracts next bar at (price) limit;
// {Sets the stop loss in dallars
SetDollarTrailing(StopLossPoints);
end;
//exit short when PLA closses above price.
If CurrentBar > 1 and pla1 > pla2 and marketposition = -1 then begin
Buytocover ("PLA Short Exit") from entry ("PLA Crossunder" ) 1 contracts next bar at market;
end;
|