Range Break Help
futures io futures trading


Range Break Help
Updated: Views / Replies:169 / 6
Created: by ummmx2 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Range Break Help

  #1 (permalink)
Miami Florida/Dade
 
 
Posts: 5 since Oct 2016
Thanks: 1 given, 0 received

Range Break Help

Hello,

I am new to easy language and just trying to code a few basic things for practice. My exercise in this code was to create a range and get the computer to plot a horizontal line framing the range (at the high and the low) from the start time to the end time and then recognize a break to the upside or break to the downside of the range.

Thought Process:
I created a for loop to try and get the computer to recognize the highest high and lowest low across a specified number of bars back.

I then tried to store this value in 2 variables called ONRHigh and ONRLow.

I then wanted to see if I could get text to print on the bars that closed higher or lower than the range for that day to verify that I had wrote the code for the highest high and lowest low of the range correct. I did not get the correct print. It would randomly print maybe one "up" during each day at a location that did not make sense.

I also wanted to see if I could plot the trendlines to see if maybe I could check where it's plotting the lines but when I tried to apply it to the chart I keep getting an error "tried to reference back more bars than allowed by the current maxbarsback". I tried changing this to extremely high numbers and no dice. I know its with the trendline section of the code because when I put the /// to comment it out the error does not happen.

 
Code
Inputs:
NumBarsBack (108),
TimeBegin (1805),
TimeEnd(0200);

Variables:
BarBackNo (0),
ONRHigh (0),
ONRLow (0),
ONRHighLine (ONRHigh);

ONRHigh = -99;
ONRLow = -99;

If Date <> Date[1] then Begin
	If Time =  TimeEnd then Begin	
		For BarBackNo = 0 to NumBarsBack
		Begin 
			ONRHigh = Highest(H, NumBarsBack);
			ONRLow = Lowest (L, NumBarsBack);
			End;
	End;
	If Close > ONRHigh then Value1 = text_new (D, T, H, "Up");
	If Close < ONRLow then Value2 = text_new (D, T, L, "Down");	
End;

ONRHighLine = TL_New (Date, Time[TimeBegin], ONRHigh, Date[1], Time[TimeEnd], ONRHigh);
TL_SetExtRight(ONRHighLine, True);
If anyone could please help me or point me in the right direction I would really appreciate it as it's a bit frustrating when I have no idea what I'm doing wrong.

Reply With Quote

Can you help answer these questions
from other members on futures io?
Need help to code these studies
ThinkOrSwim
market_cipher5_bg
ThinkOrSwim
Convert tradeStation code in tradingview
TradeStation
BigML with Trading Datasets
Traders Hideout
TTM Value or TTM Value Alert
TradeStation
 
Best Threads (Most Thanked)
in the last 7 days on futures io
ES futures Spoo-nalysis SP500/SPX
261 thanks
Coronavirus COVID-19
221 thanks
Recession? Depression? Bailout!
221 thanks
Finally Turning the Corner, tha "its 80% Psychology" thing...
82 thanks
Understanding Footprint Charts / Number bars
69 thanks
 
  #2 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,163 since Apr 2013
Thanks: 384 given, 1,396 received

ummmx2,

you perform most of your code logic on the first bar of the new day only. Unless this bar happens to have the same time as your TimeBegin input, you might not perform the check on every day. Besides that it's not clear why you would use a loop here as the ONRHigh and ONRLow variables would only hold the value for the last loop iteration anyway and highest and lowest functions internally perform a loop already.
This is a good example where commenting the code could be helpful to explain your intentions, as without knowing why you do what you do it is harder to point you in the right direction.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
 
  #3 (permalink)
Miami Florida/Dade
 
 
Posts: 5 since Oct 2016
Thanks: 1 given, 0 received


Ok so I had it perform the logic on the last bar because I wanted it to start the look back period at the end of where I wanted the range. So say I wanted the range from 5pm-2am. I had it start the logic at 2am and look back whatever amount of bars from there. In this case 108 bars. I wanted to store the highest high within that range and the lowest low within that range so that after the end time I could assess a break on whatever side of the range. This is why I thought a for loop would be good to store the value of the variables for just the day and restart the next day.

Reply With Quote
 
  #4 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,163 since Apr 2013
Thanks: 384 given, 1,396 received

ummmx2,

I would suggest using the print reserved word to check when your logic is evaluated and what exactly happens within the code and if it is even executed when you think it is.

Regards,

ABCTG


ummmx2 View Post
Ok so I had it perform the logic on the last bar because I wanted it to start the look back period at the end of where I wanted the range. So say I wanted the range from 5pm-2am. I had it start the logic at 2am and look back whatever amount of bars from there. In this case 108 bars. I wanted to store the highest high within that range and the lowest low within that range so that after the end time I could assess a break on whatever side of the range. This is why I thought a for loop would be good to store the value of the variables for just the day and restart the next day.


Follow me on Twitter Visit my Facebook Reply With Quote
 
  #5 (permalink)
Miami Florida/Dade
 
 
Posts: 5 since Oct 2016
Thanks: 1 given, 0 received

Ok I've been stuck on this for a few days and I really don't know what to do or how to go about fixing this. I tried to lookup and implement the print function but it's not sending anything to the print log and the help screen for the print function is confusing. I wrote out my logic line by line so that maybe I could get some insight as to where I'm going wrong with my thinking.

 
Code
Inputs:
NumBarsBack (108),
TimeBegin (1805),
TimeEnd(0200);

Variables:
BarBackNo (0),
ONRHigh (0),
ONRLow (0),
ONRHighLine (ONRHigh);

ONRHigh = -99 //this is an attempt to reset the variables after each day but I suppose ONR high variable reset should be put at a positive 9999?
ONRLow = -99 

If Date <> Date[1] then Begin //Using this to reset the code every day
	If Time =  TimeEnd then Begin //This line is to start executing the code when the range is over	
		For BarBackNo = 0 to NumBarsBack //This section is to look back (at the range indicated from this bar back to wherever number bars back I specify)
		Begin 
			ONRHigh = Highest(H, NumBarsBack); //these are to get the high and low within that range and to store in a variable
			ONRLow = Lowest (L, NumBarsBack);
			End;
	End;
	If Close > ONRHigh then Value1 = text_new (D, T, H, "Up"); //we are now attempting to use the stored variables as the high/low of the range and assessing a break above/below
	If Close < ONRLow then Value2 = text_new (D, T, L, "Down");	//I wanted text new as a way to check to make sure the breaks were happening in the right place
	Print(ELDateToString(date), Time, Time:0:0, ONRHigh, ONRLow); //this is a sad attempt to print something to the printlog because I have no idea what I'm doing here
End;

//ONRHighLine = TL_New (Date, Time[TimeBegin], ONRHigh, Date[1], Time[TimeEnd], ONRHigh);

Reply With Quote
 
  #6 (permalink)
Africa
 
Trading Experience: Advanced
Platform: TradeStation
Favorite Futures: ES,YM,CL,GC
 
Posts: 65 since Sep 2017
Thanks: 78 given, 54 received


ummmx2 View Post
Hello,

I am new to easy language and just trying to code a few basic things for practice. My exercise in this code was to create a range and get the computer to plot a horizontal line framing the range (at the high and the low) from the start time to the end time and then recognize a break to the upside or break to the downside of the range.

I would try a different approach, if I understand it correctly your basically looking at the ORB Strategy.

I see you do the FOR loop, but you dont have to, the engine goes and checks each bar from back to front,
so its technically doing the for loop for you.
So you are currently
- looping through each bar and then
- doing a second loop at each bar

To get the high and low of each bar during a time you can

---Reset----
If Date <> Date[1] then
Begin
ONRHigh = -999999;
ONRLow = +999999;
end;

---Get the range values---
if Time >= 0900 and Time < 1000
begin
ONRHigh = MaxList( ONRHigh, High );
ONRLow = MinList( ONRLow, Low );
End;

---After closing time---
if Time >= 1000
begin
if High > ONRHigh buy at....
if Low < ONRLow sell at...
end;


This will only get you 1 day's view, i.e. it will work for an algo but not
for an indicator where you try and plot every days range.

* you also need to make sure that the timeframe selected is smaller so it fits in the timerange

Hope that helps.

Reply With Quote

Reply



futures io Trading Community Platforms and Indicators EasyLanguage Programming > Range Break Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help on 10 day daily range break intraday filter vinnyb64 ThinkOrSwim 0 April 23rd, 2017 04:34 PM
Code for range break out strategy ticker NinjaTrader 22 April 20th, 2016 01:24 PM
Break Even or Break a Leg aligator The Elite Circle 10 May 2nd, 2013 03:26 AM
Range Bars as base type for Better Line Break? aligator Traders Hideout 4 September 25th, 2011 10:04 PM
Volatility Break Indicator (ZCHOP) record100 NinjaTrader 7 June 4th, 2011 02:16 PM


All times are GMT -4. The time now is 01:28 AM. (this page content is cached, log in for real-time version)

Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts