NexusFi: Find Your Edge


Home Menu

 





need help with a plot in EasyLanguage with knowledge of ThinkScript


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one kidvic with 12 posts (0 thanks)
    2. looks_two Jura with 7 posts (4 thanks)
    3. looks_3 ABCTG with 3 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 9,462 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 22 posts
    2. attach_file 2 attachments




 
Search this Thread

need help with a plot in EasyLanguage with knowledge of ThinkScript

  #1 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3

Does anyone know how to plot a HORIZONTAL line similar to the HIGHESTALL plot found in ThinkScript, and make it into easyLanguage?
ex.
plot priceLine = highestAll(if isNan(close[-1]) and !isNAN(close) then close else double.nan);

What this effectively does is create 1 and only 1 price level line.

Thanks and cheers!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690



kidvic View Post
Does anyone know how to plot a HORIZONTAL line similar to the HIGHESTALL plot found in ThinkScript, and make it into easyLanguage?
ex.
plot priceLine = highestAll(if isNan(close[-1]) and !isNAN(close) then close else double.nan);

What this effectively does is create 1 and only 1 price level line.

If this `highestAll()` function returns the highest price from all bars on the chart, I think you need to create a custom function for this that uses Symbol_High since that keyword is not limited by the indicator's MaxBarsBack value. You probably want to use a for loop to loop over all those `Symbol_High[]` values.

Drawing a horizontal trend line can be done with TL_New_s. The easiest way to do so is probably setting its time and date to the current bar and the previous bar, and then use the TL_SetExtLeft and TL_SetExtRight keywords to extend the trend line in both directions indefinitely. That saves you from having to update the trend line manually with each new price bar being formed. You would, however, need to check if the new price bars perhaps form a new high.

Reply With Quote
Thanked by:
  #4 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3

Can you show me an example of trendline to extending from left to right from a high[3]?

Reply With Quote
  #5 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


Jura View Post
If this `highestAll()` function returns the highest price from all bars on the chart, I think you need to create a custom function for this that uses Symbol_High since that keyword is not limited by the indicator's MaxBarsBack value. You probably want to use a for loop to loop over all those `Symbol_High[]` values.

Drawing a horizontal trend line can be done with TL_New_s. The easiest way to do so is probably setting its time and date to the current bar and the previous bar, and then use the TL_SetExtLeft and TL_SetExtRight keywords to extend the trend line in both directions indefinitely. That saves you from having to update the trend line manually with each new price bar being formed. You would, however, need to check if the new price bars perhaps form a new high.


Can you show me an example of trendline to extending from left to right from a high[3]?

Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

kidvic,

something like this should get you going as an example:

 
Code
	TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
		TL_SetExtRight( TLID, true ) ;
		TL_SetExtLeft( TLID, true ) ;
Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


ABCTG View Post
kidvic,

something like this should get you going as an example:

 
Code
	TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
		TL_SetExtRight( TLID, true ) ;
		TL_SetExtLeft( TLID, true ) ;
Regards,
ABCTG

I tried it, it helps, but the result isn't giving me one line. instead it is plotting me the high of every candle instead of the high of 3 candles ago only.

vars: TLID (High[3]);

TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
TL_SetExtRight( TLID, true ) ;
TL_SetExtLeft( TLID, true ) ;

This is the complete code I used. Am I missing something?

Reply With Quote
  #8 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


kidvic View Post
I tried it, it helps, but the result isn't giving me one line. instead it is plotting me the high of every candle instead of the high of 3 candles ago only.

vars: TLID (High[3]);

TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
TL_SetExtRight( TLID, true ) ;
TL_SetExtLeft( TLID, true ) ;

This is the complete code I used. Am I missing something?

You'll need to add a Boolean variable that acts as a check to see if the line has already been drawn or not. For example:

 
Code
vars: TLID (High[3]), IntraBarPersist alreadyPlotted(false);

if (alreadyPlotted = false) then begin
  
    TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
		TL_SetExtRight( TLID, true ) ;
		TL_SetExtLeft( TLID, true ) ;
    
    alreadyPlotted = true;
    
end;

Reply With Quote
Thanked by:
  #9 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


Jura View Post
You'll need to add a Boolean variable that acts as a check to see if the line has already been drawn or not. For example:

 
Code
vars: TLID (High[3]), IntraBarPersist alreadyPlotted(false);

if (alreadyPlotted = false) then begin
  
    TLID = TL_New( Date[3], Time[3], High[3], Date, Time, High[3] ) ;
		TL_SetExtRight( TLID, true ) ;
		TL_SetExtLeft( TLID, true ) ;
    
    alreadyPlotted = true;
    
end;

It's finally only 1 line, however it is reading the wrong candle, and not candle 3 ago.

Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


kidvic,

if you always want the trendline to mark the high three candles ago you'll have to update the trendline location every bar.
Look up TL_SetBegin and TL_SetEnd in the Tradestation help. This will show you how to change the start and end points for a trendline.

Regards,
ABCTG

Follow me on Twitter Reply With Quote




Last Updated on May 24, 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