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,649 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

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


ABCTG View Post
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

Still not working as I've updated the code with your help:

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 ) ;
TL_SetBegin (TLID, Time[3], High[3], High[3]);
TL_SetEnd (TLID, Time[3], High[3], High[3]);


alreadyPlotted = true;

end;
......................That code still produces the wrong bar to draw a trendline one.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #12 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

You placed the the location update inside the check that is only executed once to draw the trendline. Also compare the start and end point used for drawing the trendline with what you are using for the location update.

Regards,
ABCTG


kidvic View Post
Still not working as I've updated the code with your help:

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 ) ;
TL_SetBegin (TLID, Time[3], High[3], High[3]);
TL_SetEnd (TLID, Time[3], High[3], High[3]);


alreadyPlotted = true;

end;
......................That code still produces the wrong bar to draw a trendline one.


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



ABCTG View Post
You placed the the location update inside the check that is only executed once to draw the trendline. Also compare the start and end point used for drawing the trendline with what you are using for the location update.

Regards,
ABCTG

Not following what you mean.
The location is the high of 3 candles ago, I've referenced it many times so that it knows the candle i'm talking about.

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


kidvic View Post
Not following what you mean.
The location is the high of 3 candles ago, I've referenced it many times so that it knows the candle i'm talking about.

As I understand it, ABCTG means that you shouldn't put the location update in the code block that's only executed once (i.e., when `alreadyPlotted` is false). That probably makes sense when you think about it.

If you want to update the trend line on the close of each bar (for example), you can do as follows:

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

// Only draw the trend line once when
// `alreadyPlotted` is 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;

// Then update the location of the trend line on
// the close of each bar
if (BarStatus(1) = 2) then begin

  TL_SetBegin (TLID, Time[3], High[3], High[3]);
  TL_SetEnd (TLID, Time[3], High[3], High[3]);

end;
But if I make a suggestion Kidvic, perhaps it's wise to rethink what you're actually want to make. Because the code we're helping you now with has little to do with your question that started this thread.

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


Jura View Post
As I understand it, ABCTG means that you shouldn't put the location update in the code block that's only executed once (i.e., when `alreadyPlotted` is false). That probably makes sense when you think about it.

If you want to update the trend line on the close of each bar (for example), you can do as follows:

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

// Only draw the trend line once when
// `alreadyPlotted` is 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;

// Then update the location of the trend line on
// the close of each bar
if (BarStatus(1) = 2) then begin

  TL_SetBegin (TLID, Time[3], High[3], High[3]);
  TL_SetEnd (TLID, Time[3], High[3], High[3]);

end;
But if I make a suggestion Kidvic, perhaps it's wise to rethink what you're actually want to make. Because the code we're helping you now with has little to do with your question that started this thread.

Jura, the HighestALL function was resolved when you suggested the tl_new and extensions to left, and right. The example you saw was so you can see what I mean when I meant a HORIZONTAL line. (the condition was an example that created the horizontal line)
This last script you posted worked perfect alone, however when I introduced it to my script I ran into a few problems.

I think the best way to go about it now is to maybe actually call a barNumber. I have tried but I failed.
I have used the MaxBarsBack function, but I think I might be using it wrong. Also, I see a function called LastBarOnChart, but as I'm a noob programmer, I might be interpreting the syntax wrong.
I thought I might use (LastBarOnChart - 3) but that doesn't seem to work either.
I continue to try different ways, but It doesn't seem to work.

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


kidvic View Post
This last script you posted worked perfect alone, however when I introduced it to my script I ran into a few problems.

I think the best way to go about it now is to maybe actually call a barNumber. I have tried but I failed.
I have used the MaxBarsBack function, but I think I might be using it wrong. Also, I see a function called LastBarOnChart, but as I'm a noob programmer, I might be interpreting the syntax wrong.
I thought I might use (LastBarOnChart - 3) but that doesn't seem to work either.
I continue to try different ways, but It doesn't seem to work.

Can you clarify what you're trying to achieve now? It's not very clear to me, sorry. Why would you like the use the bar number for example?

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


Jura View Post
Can you clarify what you're trying to achieve now? It's not very clear to me, sorry. Why would you like the use the bar number for example?

Because as I've introduced the Above code into my script And it's really really slow. Also removing the trendline to the left does not remove it. Using current bar Plots a trend line on that bar.

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


kidvic View Post
Because as I've introduced the Above code into my script And it's really really slow. Also removing the trendline to the left does not remove it. Using current bar Plots a trend line on that bar.

Could you post the code that you are using now? Then we can take a look at it. If it's proprietary, can you create a code example that replicates this problematic behaviour?

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


Jura View Post
Could you post the code that you are using now? Then we can take a look at it. If it's proprietary, can you create a code example that replicates this problematic behaviour?

 
Code
Var: TL_ID(-1);
if (CurrentBar = 10)
 then begin
 TL_ID = TL_New(Date, Time, High, Date, Time, Low);
end;
if (CurrentBar = 11)
 then begin
 TL_SetEnd(TL_ID, Date, Time, Low);
end;
Currentbar draws at bar 10 from left to right, how about from right to left?

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



kidvic View Post
 
Code
Var: TL_ID(-1);
if (CurrentBar = 10)
 then begin
 TL_ID = TL_New(Date, Time, High, Date, Time, Low);
end;
if (CurrentBar = 11)
 then begin
 TL_SetEnd(TL_ID, Date, Time, Low);
end;
Currentbar draws at bar 10 from left to right, how about from right to left?

Can you expand more on what the trend line drawn from right to left needs to do? Is that right-to-left trend line still drawn on the same bars and price coordinates? Or should that line be drawn on future, yet to form price bars? If so, how should that trend line be updated; extended further into the future or remain in place?

Btw, your current code draws a trend line on historical data and then extends it once on the next bar. Is that what you want it to do? I'm asking because this is something else than I understood from your previous posts in this thread, so there might be a misunderstanding here.

PS: a screenshot with your goal will probably speak more than words.

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