Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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?
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.
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];
//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.
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..
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.
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)?
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.
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.
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.