NexusFi: Find Your Edge


Home Menu

 





Basic question on EasyLanguage


Discussion in EasyLanguage Programming

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




 
Search this Thread

Basic question on EasyLanguage

  #1 (permalink)
cruncher
Milan, Italy
 
Posts: 2 since Oct 2015
Thanks Given: 2
Thanks Received: 0

Hi everyone
I don't use Easy Language but I found this code and I would like some help understanding what the first "Sell next bar" means:

 
Code
Variable: 
    down_days(3), max_holding_days(4), trade_size(50), average_daily_range(0), daily_price_change(0); 
 
daily_price_change = Close - Close[1]; 
average_daily_range = AvgTrueRange(50); 
 
// Buy MOC if market is down more than 5% of average daily range 3 days in a row: 
If Marketposition = 0 and Highest(daily_price_change, down_days) < - average_daily_range * 5/100 then  
                Buy("Entry") trade_size Contracts this bar at Close; 
                 
// Stop loss at 2 daily ranges from last close:  
Sell("Exit_Stop") next bar at Close - 2*average_daily_range Stop; 
 
// Profit take at half daily range from last close: 
Sell("Exit_Prft") next bar at Close + 0.5*average_daily_range Limit;
1) for every bar since the buy, calculate the average true range for the past 50 bars and set a stop for the next bar at this bar's close minus twice the ATR -> the stop level is changed continuously
OR
2) at buy's bar, calculate the average true range for the past 50 bars, calculate the stop level at buy's bar's close minus twice the ATR, and then for each bar since the buy set a stop at the calculated level -> the stop level is fixated at the buy signal

Which one (or maybe none) is the right interpretation?

Thanks

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
25 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690



cruncher View Post
1) for every bar since the buy, calculate the average true range for the past 50 bars and set a stop for the next bar at this bar's close minus twice the ATR -> the stop level is changed continuously
OR
2) at buy's bar, calculate the average true range for the past 50 bars, calculate the stop level at buy's bar's close minus twice the ATR, and then for each bar since the buy set a stop at the calculated level -> the stop level is fixated at the buy signal

You're very close with (1), except that it's not 'for every bar since the buy'.

The script calculates its variables with every calculation, on every bar (without depending on the buy):
 
Code
daily_price_change = Close - Close[1]; 
average_daily_range = AvgTrueRange(50);
It then submits the stop:

 
Code
Sell("Exit_Stop") next bar at Close - 2*average_daily_range Stop;
Since the `Close` and `average_daily_range` change with each calculation, your first interpretation is correct: the stop changes with each script calculation.

Reply With Quote
  #4 (permalink)
cruncher
Milan, Italy
 
Posts: 2 since Oct 2015
Thanks Given: 2
Thanks Received: 0

Thank you Jura, very helpful!

Reply With Quote




Last Updated on October 31, 2015


© 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