NexusFi: Find Your Edge


Home Menu

 





Simple Long Strategy Tempplate Help


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #2 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
Posts: 37 since Mar 2012
Thanks Given: 2
Thanks Received: 22


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 X 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


© 2026 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 - Downloads - Top
no new posts