NexusFi: Find Your Edge


Home Menu

 





Simple Long Strategy Tempplate Help


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,513 views
    2. thumb_up 1 thanks given
    3. group 5 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Simple Long Strategy Tempplate Help

  #1 (permalink)
 cnbcsucks 
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;

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
Posts: 34 since Mar 2012
Thanks Given: 1
Thanks Received: 21


cnbcsucks View Post
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

"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;

To begin, I need to know how you define a new green bar - is it a bar with a close greater than the open? is it a bar whose close is greater than the close of one bar ago?
Is it something else?

Also , I believe mystop should be equal to the lowest(Low,2)

so

"If current bar is green and the current bar low is < previous bar low then begin
mystop = Lowest(Low,2);
end;

sorry, but don't have time yet to work on this further. Please define green bar better.

Follow me on Twitter Reply With Quote
  #3 (permalink)
 
numberjuani's Avatar
 numberjuani 
Agoura Hills, CA USA
 
Experience: Advanced
Platform: Tradestation&Multicharts
Broker: TradeStation
Trading: Futures & Equities
Posts: 128 since Apr 2019
Thanks Given: 9
Thanks Received: 102


Inputs:

EntrNShares(100),
ExitNSharesFirst(50),
ExitNSharesSecond(50),
Profit1(.30),
Profit2(.70),
HardStops(1.0);

Variables:
mystop (0);


If C > O and L < L[1] then begin
mystop = (C - L);
else
mystop = (C - L[1]);
end;

if C > O then
Buy ("LONG") EntrNShares shares next bar market;

Sell ("Sell Target 1") ExitNSharesFirst shares next bar entryprice + profit1 limit;
Sell ("Sell Target 2") ExitNSharesSecond shares next bar entryprice + profit2 market;

SetStopShare
SetStopLoss(mystop);

Reply With Quote
Thanked by:




Last Updated on May 29, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts