Future Reference to Past Bar - EasyLanguage Programming | futures.io
futures io futures trading


Future Reference to Past Bar
Started: by Vientomarsol Views / Replies:847 / 23
Last Reply: Attachments:11

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


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, and we will never resell your private information.

-- Big Mike

Reply
 11  
 
Thread Tools Search this Thread
 

Future Reference to Past Bar

  #11 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

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

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #12 (permalink)
Trading Apprentice
Port St. Lucie, FL.
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 18 since May 2016
Thanks: 10 given, 6 received

Please hang with Me - I don't want to lose Your Help !

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)
Trading Apprentice
Port St. Lucie, FL.
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 18 since May 2016
Thanks: 10 given, 6 received

Almost Have it !!!


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
Future Reference to Past Bar-bitmap-1.bmp   Future Reference to Past Bar-bitmap-2.bmp   Future Reference to Past Bar-bitmap-3.bmp   Future Reference to Past Bar-bitmap-4.bmp  
Reply With Quote
 
  #14 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

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

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #15 (permalink)
Trading Apprentice
Port St. Lucie, FL.
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 18 since May 2016
Thanks: 10 given, 6 received

Where did you learn all this stuff??

Futures Edge on FIO
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)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

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.


Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #17 (permalink)
Trading Apprentice
Port St. Lucie, FL.
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 18 since May 2016
Thanks: 10 given, 6 received

Response to ABCTG

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)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received

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


Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #19 (permalink)
Trading Apprentice
Port St. Lucie, FL.
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 18 since May 2016
Thanks: 10 given, 6 received

Got it Running !!!

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
The following 2 users say Thank You to Vientomarsol for this post:
 
  #20 (permalink)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,257 since Apr 2013
Thanks: 201 given, 707 received


Vientomarsol,

you are welcome and thank you for your kind words.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:

Reply



futures io > > > > > Future Reference to Past Bar

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Mastering Trading Pysychology w/Brett Steenbarger & Trading Technologies

Elite only

PTMC Protrader Platform First Look w/Sergey Sokolov

Elite only

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only

FIO Video Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

April

Process above all else w/Anthony Crudele @ Futures Radio Show

Elite only

Machine Learning - Quantitative Trading w/Martin Froehler @ Quantiacs

Elite only

Market Dynamics w/Peter Davies @ Jigsaw Trading

Elite only

Ask Me Anything w/Patrick Rooney @ Trading Technologies

Apr 18

Ask Me Anything w/FuturesTrader71

Apr 19

Machine Learning w/Kris Longmore

Elite only

Market Analysis w/Dave Forss

Apr 25

Introducing iSystems with Stage 5 Trading

Apr 27
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding real price of current and past ADXVMA bar SolubleFish NinjaTrader Programming 10 May 20th, 2016 03:31 PM
reference last bar (of week) yeshe NinjaTrader Programming 2 October 21st, 2014 11:23 AM
Analyzing trades: Past vs Future Big Mike Psychology and Money Management 7 October 14th, 2012 04:54 PM
reference future data in EasyLanguage? shzhning EasyLanguage Programming 9 October 4th, 2012 10:28 AM
plot axis reference for bar style SARdynamite NinjaTrader Programming 1 July 17th, 2010 06:02 AM


All times are GMT -4. The time now is 04:25 AM.

no new posts
Page generated 2017-03-24 in 0.14 seconds with 20 queries on phoenix via your IP 54.145.208.160