PDX, Oregon
Experience: Intermediate
Platform: NinjaTrader, Tradestation
Broker: Tradestation
Posts: 13 since Jan 2010
Thanks Given: 3
Thanks Received: 4
|
Hi Everyone, I'm trying to create a simple long strategy template to buy on a new green bar with stop below the most recent low of current bar or previous bar whichever is lower. Profit target of .30 and .70 to or stop below the the most recent low near entry bar. After profit target 1, move stop to break even. If ncessary, a hardstop of 1.0 to close out position.
I have a mixture of EL and pseudo code below. Can anyone help fill in the EL to the strategy?
A big thank you to anyone who can help.
Inputs:
EntrNShares(100),
ExitNSharesFirst(50),
ExitNSharesSecond(50),
Profit1(.30),
Profit2(.70),
HardStops(1.0);
Variables:
mystop (0);
"If current bar is green and the current bar low is < previous bar low then begin
mystop = low of current bar
else
mystop = low of previous bar
end;
If marketposition <> 1 and "current bar close is greater then open" then begin
Buy ("LONG") EntrNShares shares next bar open market;
"Mystop = Entryprice"
End;
If marketposition = 1 then begin
Sell ("Sell Target 1") ExitNSharesFirst shares next bar entryprice + profit1 limit;
Sell ("Sell Target 2") ExitNSharesSecond shares next bar entryprice + profit2 market;
end;
If marketposition = 1 and "price crosses under mystop or hardstop' then begin
"close position" market
end;
|