NexusFi: Find Your Edge


Home Menu

 





Future Reference to Past Bar


Discussion in EasyLanguage Programming

Updated
    1. trending_up 10,961 views
    2. thumb_up 16 thanks given
    3. group 3 followers
    1. forum 23 posts
    2. attach_file 11 attachments




 
Search this Thread

Future Reference to Past Bar

  #11 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

Vientomarsol,

I am afraid your code wouldn't compile (as it contains pseudo code) and to properly debug it one would most likely need a working version (where you could exchange the proprietary parts to something open source, as long as same the problems stay apparent).

You might want to print the values your code generates and check what values were used exactly at the bars that "appear" problematic".

You wrote "In at least one case, an exit was made on a subsequent trigger Bar Low.". If I understand you correctly this is exactly what I meant here. Did you try the suggestion I gave you to avoid that?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
NexusFi Journal Challenge - May 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
32 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #12 (permalink)
Vientomarsol
Port St. Lucie, FL.
 
Posts: 25 since May 2016
Thanks Given: 17
Thanks Received: 9

Hello ABCTG,

I was afraid my pseudo code might 'queer the deal'. My Values 1 and 2 are purchased indicators that contain a password in the values themselves, so I can't post them on a public forum.

I have an idea. Let me rewrite my code using Larry Williams' famous "Naked Bottom' as my trigger bar. Larry has been gracious enough to release this indicator to the public, so I can upload his code without fear. (and give him a plug).

I'll run the Naked Bottom Trigger System (and use your code to store the values) and see what I get. I'll post the results this afternoon.

I'm hoping you will be kind enough take a look at those results, and provide specific comments and suggestions..

Again, thanks sooo much for hanging with me, and trying to 'show me the way'. I'll have the updated results up by EOD today.

Respectfully,

Reply With Quote
  #13 (permalink)
Vientomarsol
Port St. Lucie, FL.
 
Posts: 25 since May 2016
Thanks Given: 17
Thanks Received: 9


Greetings ABCTG,

I’m happy to report that I've updated my code to use Larry Williams’ “NAKED BOTTOM” indicator as my Trigger Bar, and with one [hopefully] minor exception, it works!!!

Here is the code:
Var:
MP(0),//MP = marketposition
bool isTriggerBar ( false ),
double triggerBarHigh ( 0 ),
double triggerBarLow ( 0 );

//reset flag
isTriggerBar = false ;

isTriggerBar = isTriggerBar or Condition1;

//trigger bar detected, store values
if isTriggerBar then
begin
triggerBarHigh = High[1] ;
triggerBarLow = Low[1] ;
end ;

//Naked Btm Condition
Condition1 = C[1]<L[2] and C>H[1];

//Filter Conditions
Condition2 = High > High[1];
Condition3 = Low > Low[1];
Condition4 = Low = Low[1];

//Plots
//Naked Btm TriggerBar
If Condition1 then Plot1(Low - .25, "Nkd_Btm", red);

//Long Entry
If Condition1[1] {previous bar = Naked Btm} and Condition2 {this bar = Higher High than Naked Btm}
and (Condition3 or condition4) {this bar = Low =/> Naked Btm} then begin Plot2 (Low - .25, "LE", White);
MP = 1;
End;

//Long Exit on Break of Trigger Bar bottom
If MP=1 and L < triggerBarLow then begin Plot3(Low - .25, "LX", Cyan);
MP = 0;
End;

WHAT IS WORKING:

When using “NAKED BOTTOM” as Condition1, the following sequence is expected:

A. Long entry (MP=1) is initiated via:
o Condition1[1] and Condition2 and (Condition3 or condition4)

And then:

B. An exit is initiated via:
o MP=1 and L < Condition1

The above code works flawlessly in all cases but one. The exception is as follows:

WHAT IS NOT WORKING:


C. Long entry (MP=1) is initiated via:
o Condition1[1] and Condition2 and (Condition3 or condition4)

And then:

D. A second Condition1 (Trigger Bar) plots without conditions 2, 3, or 4 and no entry is initiated

And then:

E. An exit is initiated on < Low of item D (above) rather than item B (above).

Examples of Item D exits are circled on attached screen-prints.

QUESTIONS:

1. Do why know why I'm exiting on < Low of item D (above) rather than item B (above)?

2. Do you know how to revise my code so this will not happen?


As always, I'm mucho appreciative of your help.

You're a very smart guy, and have shown me EL functions which I did not know were possible.

Again, Thanks!!

Attached Thumbnails
Click image for larger version

Name:	BitMap#1.bmp
Views:	176
Size:	2.47 MB
ID:	212393   Click image for larger version

Name:	BitMap#2.bmp
Views:	185
Size:	2.47 MB
ID:	212394   Click image for larger version

Name:	BitMap#3.bmp
Views:	190
Size:	2.47 MB
ID:	212395   Click image for larger version

Name:	BitMap#4.bmp
Views:	188
Size:	2.47 MB
ID:	212396  
Reply With Quote
  #14 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

Vientomarsol,

EasyLanguage code is evaluated from top to bottom (unless you use methods, which you don't). If you use a variable or condition before you evaluate it in your code, you will use the previous bar's (or code execution's) value for it.

I would strongly suggest to use the Print command or the plot reserved words in your debugging, to actually see what values a variable in your code holds at the very moment, when it gets updated etc..

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #15 (permalink)
Vientomarsol
Port St. Lucie, FL.
 
Posts: 25 since May 2016
Thanks Given: 17
Thanks Received: 9

ABCTG,

I don't know how to use the Print command, or the plot reserved words in your debugging, but I'll figure it out and post my results.

Thanks again for your prompt reply.

Reply With Quote
  #16 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

Vientomarsol,

you are already using "Plot" in your code. Plots are a great way to visualize what is going on in your code when trying to track problems down.

Look the "print" reserved word up in the editor's help - for example by writing print in your code, highlighting it and pressing F1. This will bring up the online help and give you ideas on how to use it. With that you can print values at certain times or continuously to the output log - this is a great way to keep track on what is going on in your code.

Regards,

ABCTG




Vientomarsol View Post
ABCTG,

I don't know how to use the Print command, or the plot reserved words in your debugging, but I'll figure it out and post my results.

Thanks again for your prompt reply.


Follow me on Twitter Reply With Quote
Thanked by:
  #17 (permalink)
Vientomarsol
Port St. Lucie, FL.
 
Posts: 25 since May 2016
Thanks Given: 17
Thanks Received: 9

ABCTG,

Yes, I have figured out how to use the plot function to verify my code prior to exporting to a strategy, but I'm not familiar with the print (Parameter) function.

I just read the Tradestation EL description of 'Print (Parameter)' function, and (to me anyway) it may as well be written in Chinese.

Could you give me an example of how this function would be coded to print the sequence of my code (or part of the code)?

Thanks

Reply With Quote
  #18 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628

Vientomarsol,

the examples Tradestation provides in their help (at least for the print) are quite good actually and cover everything you need to know. In your case I'd start with checking what values are stored for the trigger bar and more important when they are stored.

 
Code
//trigger bar detected, store values
if isTriggerBar then
begin
triggerBarHigh = High[1] ;
triggerBarLow = Low[1] ;
Print( ElDateToString( Date ), "; Time: ", Time:0:0, "; triggerBarHigh: ", triggerBarHigh, "; triggerBarLow: ", triggerBarLow ) ;
end ;
The print statement will go to Tradestation's Print Log tab in the main window. If you don't see it, you will have to enable it under -> View -> EasyLanguage Print Log.

This, together with using Plots to display values on the chart, should give you a good start to find out yourself what is going on in your code.

Regards,

ABCTG


Vientomarsol View Post
ABCTG,

Yes, I have figured out how to use the plot function to verify my code prior to exporting to a strategy, but I'm not familiar with the print (Parameter) function.

I just read the Tradestation EL description of 'Print (Parameter)' function, and (to me anyway) it may as well be written in Chinese.

Could you give me an example of how this function would be coded to print the sequence of my code (or part of the code)?

Thanks


Follow me on Twitter Reply With Quote
Thanked by:
  #19 (permalink)
Vientomarsol
Port St. Lucie, FL.
 
Posts: 25 since May 2016
Thanks Given: 17
Thanks Received: 9

ABCTG,

You code was exactly what I needed. I plugged it in, and it is outputting to my PrintLog as I write this.
I'll keep an eye on the print output today, and see if I can define my glitch.



I'm humbled by your generosity.
Again, thanks so much. I'll report back on my findings.

Reply With Quote
Thanked by:
  #20 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,628


Vientomarsol,

you are welcome and thank you for your kind words.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on August 2, 2016


© 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