NexusFi: Find Your Edge


Home Menu

 





weekly High & Low S&R breakout strategy on the daily timeframe


Discussion in EasyLanguage Programming

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




 
Search this Thread

weekly High & Low S&R breakout strategy on the daily timeframe

  #1 (permalink)
Stranderik
Skien, Norway
 
Posts: 5 since Jun 2022
Thanks Given: 1
Thanks Received: 0

Hi, everyone!
I’m trying to code a weekly High & Low S&R breakout strategy on the daily timeframe.

On the weekly timeframe the strategy would simply be:
Buy next bar at High Stop;
Sellshort next bar at Low Stop;

Very simple.
But to do this on the daily timeframe with the last week High/Low isn’t as easy.

I can get close by using the OHLCPeriodsAgo function and create a weekly channel that I use for my Buy and Sellshort orders, only problem is it doesn’t seem to work before Monday has closed, making every breakout on Monday stay with the previous weeks period High/Low.





Is there a better way of doing this or can the OHLCPeriodsAgo function be modified so that Mondays also work as intended?

Appreciate all the help I can get.
Stranderik

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
Stranderik
Skien, Norway
 
Posts: 5 since Jun 2022
Thanks Given: 1
Thanks Received: 0

Oh, and here is the code for plotting the weekly channels:

Vars: oPeriodOpen1(0), oPeriodHigh1(0), oPeriodLow1(0), oPeriodClose1(0),
oPeriodOpen2(0), oPeriodHigh2(0), oPeriodLow2(0), oPeriodClose2(0);

// OHLCPeriodsAgo( PeriodType, PeriodsAgo, oPeriodOpen, oPeriodHigh, oPeriodLow, oPeriodClose )
// PeriodType sets the time period on which to base values (1 = Day, 2 = Week, 3 = Month, 4 = Year)

Value1 = OHLCPeriodsAgo( 2, 1, oPeriodOpen1, oPeriodHigh1, oPeriodLow1, oPeriodClose1 );

Value3 = oPeriodHigh1;
Value4 = oPeriodLow1;

Plot1( Value3 );
Plot2( Value4 );


And here is the code for the strategy:

Vars: oPeriodOpen1(0), oPeriodHigh1(0), oPeriodLow1(0), oPeriodClose1(0),
oPeriodOpen2(0), oPeriodHigh2(0), oPeriodLow2(0), oPeriodClose2(0);

// OHLCPeriodsAgo( PeriodType, PeriodsAgo, oPeriodOpen, oPeriodHigh, oPeriodLow, oPeriodClose )
// PeriodType sets the time period on which to base values (1 = Day, 2 = Week, 3 = Month, 4 = Year)

Value1 = OHLCPeriodsAgo( 2, 1, oPeriodOpen1, oPeriodHigh1, oPeriodLow1, oPeriodClose1 );

Value3 = oPeriodHigh1;
Value4 = oPeriodLow1;

Buy("BuyLong") next bar at Value3 Stop;
Sellshort("SellShort") next bar at Value4 Stop;

Reply With Quote




Last Updated on November 15, 2022


© 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