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,804 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 1 attachments




 
Search this Thread
  #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?
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
ATFX Suspends Prop Trading Unit ATFunded -- Full Review …
Funded Trading Evaluation Firms
Election Sunday Resolves: Peru Heads to Runoff at 42pct, …
Prediction Markets & Event Contracts
Powell in 48 Hours: Word Markets Give 78% on Inflation, …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 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)
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


© 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