Drawing trendline in "future" - futures io
futures io



Drawing trendline in "future"


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

Drawing trendline in "future"

(login for full post details)
  #1 (permalink)
berni147
Bratislava, Slovakia
 
 
Posts: 3 since Nov 2022
Thanks: 1 given, 0 received

Hello,

is it possible to drawn trendlines in "future"? So far I was always drawing in "history". e.g. from current candle to candle[5] before,but now I would like to draw line (constant) for next N (e.g. 5) candles. Is that possible?

From TrendLine.Create (Create(DTPoint, DTPoint)) it looks like I need date in future, so Ideally if I can get BarDateTime from next Nth candle (BarDateTime[-5] or something like that) Is that possible?

Other option would probably be to draw long line and then cut it off once Nth candle reached.

Thanks

Reply With Quote

Can you help answer these questions
from other members on futures io?
Market on Close data within IB
Platforms and Indicators
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
How to pay for market data with Dorman LLC
NinjaTrader
Big Mo Indicator for NT8
NinjaTrader
help with take profit several targets
TradeStation
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
88 thanks
An embarrassing, honest confession
25 thanks
ApexTraderFunding.com experience and review
8 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Want your NinjaTrader indicator created, free?
7 thanks
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,361 since Apr 2013
Thanks: 426 given, 1,579 received

berni147,

welcome to futures.io.

Depending on the bar type you are working with, you could calculate the end DateTime of your trendline by adding a TimeSpan which corresponds to five times the duration of your bar span to your start DateTime to calculate the end point.
Another idea could be using Barnumbers and BNPoints instead. What you mentioned in your last sentence would work as well i.e. moving the end point with every new bar for five bars.

Regards,

ABCTG


berni147 View Post
Hello,

is it possible to drawn trendlines in "future"? So far I was always drawing in "history". e.g. from current candle to candle[5] before,but now I would like to draw line (constant) for next N (e.g. 5) candles. Is that possible?

From TrendLine.Create (Create(DTPoint, DTPoint)) it looks like I need date in future, so Ideally if I can get BarDateTime from next Nth candle (BarDateTime[-5] or something like that) Is that possible?

Other option would probably be to draw long line and then cut it off once Nth candle reached.

Thanks


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #3 (permalink)
berni147
Bratislava, Slovakia
 
 
Posts: 3 since Nov 2022
Thanks: 1 given, 0 received



ABCTG View Post
berni147,

welcome to futures.io.

Depending on the bar type you are working with, you could calculate the end DateTime of your trendline by adding a TimeSpan which corresponds to five times the duration of your bar span to your start DateTime to calculate the end point.
Another idea could be using Barnumbers and BNPoints instead. What you mentioned in your last sentence would work as well i.e. moving the end point with every new bar for five bars.

Regards,

ABCTG


Thanks, BNPoints looks exactly like a way to go. However, there is something weird with it. I had a look at the definition of Trendline, there is a nice example how to use BNPoints - so I take that and apply to my case - something like this (simplified):

If LastBarOnChart then
Begin
myBNPoint1 = BNPoint.Create(barnumber,4000);
myBNPoint2 = BNPoint.Create(barnumber+10,4000);
MyTL = TrendLine.Create( myBNPoint1, myBNPoint2 ) ;
MyTL.ExtRight = False ;
DrawingObjects.Add( MyTL ) ;
End;


TrendLine is plotted but it is shifted to the left. If I add debug prints of myBNPoint1, it refers to the correct barnumber&price, even if I change barnumbers so that line is plotted in history - BNPoints seem to be correct but the line is shifted.

Funny thing is that TrendLine is shifted always by 23 candles, so if I add some magic_constant=23 there:
mag_const=23;
myBNPoint1 = BNPoint.Create(barnumber+mag_const,4000);
myBNPoint2 = BNPoint.Create(barnumber+mag_const+10,4000);

It works as expected. However, I would like to avoid Bulgarian constants in my code

Thanks!

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,361 since Apr 2013
Thanks: 426 given, 1,579 received

berni147,

when you refer to the BNPoint class description in the help file it will become clear that the maxbarsback value for a study must be included since a BNPoint refers to the absolute bar index (zero-based) of the collection of bars in a chart.

Regards,

ABCTG


berni147 View Post
Thanks, BNPoints looks exactly like a way to go. However, there is something weird with it. I had a look at the definition of Trendline, there is a nice example how to use BNPoints - so I take that and apply to my case - something like this (simplified):

If LastBarOnChart then
Begin
myBNPoint1 = BNPoint.Create(barnumber,4000);
myBNPoint2 = BNPoint.Create(barnumber+10,4000);
MyTL = TrendLine.Create( myBNPoint1, myBNPoint2 ) ;
MyTL.ExtRight = False ;
DrawingObjects.Add( MyTL ) ;
End;


TrendLine is plotted but it is shifted to the left. If I add debug prints of myBNPoint1, it refers to the correct barnumber&price, even if I change barnumbers so that line is plotted in history - BNPoints seem to be correct but the line is shifted.

Funny thing is that TrendLine is shifted always by 23 candles, so if I add some magic_constant=23 there:
mag_const=23;
myBNPoint1 = BNPoint.Create(barnumber+mag_const,4000);
myBNPoint2 = BNPoint.Create(barnumber+mag_const+10,4000);

It works as expected. However, I would like to avoid Bulgarian constants in my code

Thanks!


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #5 (permalink)
berni147
Bratislava, Slovakia
 
 
Posts: 3 since Nov 2022
Thanks: 1 given, 0 received

You are right, adding maxbarsback minus one works ; barnumber+MaxBarsBack-1 points to the current candle. Thanks a lot for your help.



ABCTG View Post
berni147,

when you refer to the BNPoint class description in the help file it will become clear that the maxbarsback value for a study must be included since a BNPoint refers to the absolute bar index (zero-based) of the collection of bars in a chart.

Regards,

ABCTG


Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Drawing trendline in "future"


Last Updated on November 29, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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