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


Future Reference to Past Bar
Updated: Views / Replies:1,004 / 23
Created: by Vientomarsol 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

  #21 (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

One Last Glitch :(

Hello ABGT,

Sorry to bug you again but I have a glitch in my TradeStation ‘Naked Bottom” system which didn’t show-up right away. I have been working on a solution for over a week, and I finally run-out of ideas.

As discussed in our earlier correspondence; my ‘Naked Bottom” exit strategy (for a Long trade) is intended to trigger a Sell when price is < Entry Low [1]. In other words: Sell on a break of the low of the ‘Bar-Before-Entry’.

The code you helped me develop performs as intended except for one flaw.

As indicated on attached Barchart of my ‘Naked Bottom” system, the intended system sequence is as follows:
1. Market Position is MP=0 (Blue Dots on chart) until Entry Signal #1 is received.

2. Entry Signal #1 is received (Red Dot on chart) which initiates MP = 1 (Yellow Dots on chart) and signals a Long Trade.

3. Entry Signal #2 (Red Dot) is received and will continue with the original trade (Still MP = 1), but is expected to re-set the ‘Exit Trigger’ to < Entry Low [1] of Entry #2.

Note: In the case of Entry #2, the < Entry Low [1] of Entry #2 was not breached, and no exit was made (as was expected).

4. Entry Signal #3 (Red Dot) is received and continues the original trade (Still MP = 1), and (as discussed in Item 3 above) the ‘Exit Trigger’ is expected to be re-set to < Entry Low [1] of Entry #3.

Note: In the case of Entry #3, the < Entry Low [1] was breached, but no exit was made. Instead; many bars later, the actual exit (Green Dot) was made on the basis of < Entry Low [1] of Entry #1 (not Entry #3), whereupon Market Position was returned to MP=0 (Blue Dots on chart)

Question / Comment:
• How may I code my ‘Exit Trigger’ to re-calculate to the < Entry Low [1] for each succeeding Entry Signal, rather than the < Entry Low [1] of my initial entry?

Note: I do understand that a re-set depends on the Market Position reverting back to MP=0, when each new Entry Signal populates, but I cannot figure out how to make that happen.
My Indicator Code for attached BarChart is as follows:
Var:
MP(0),//MP = marketposition
BuyCondition (False),
bool NakedBtm ( false ),
double NakedBtmLow ( 0 );

//reset flag
NakedBtm = false ;
NakedBtm = NakedBtm or Condition1 and MP=0;

//trigger bar detected, store values
if NakedBtm then
begin
NakedBtmLow = 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];

//Buy Condition
BuyCondition = Condition1[1] and Condition2 and Condition3 or Condition4;

//Plots

//Long Entry
If BuyCondition then begin Plot2 (Low - .25, "LE", Red);
MP = 1;
End;

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

If MP=0 then Plot10 (HIGH + .75,"MP=0", blue);

If MP=1 then Plot11 (HIGH + .75,"MP=1", yellow);

As always, thank you sooo much for your expert guidance.

Attached Thumbnails
Future Reference to Past Bar-back-guru.bmp  
Reply With Quote
 
  #22 (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

One Last Glitch :(

Hello ABGT,

Sorry to bug you again but I have a glitch in my TradeStation ‘Naked Bottom” system which didn’t show-up right away. I have been working on a solution for over a week, and I finally run-out of ideas.

As discussed in our earlier correspondence; my ‘Naked Bottom” exit strategy (for a Long trade) is intended to trigger a Sell when price is < Entry Low [1]. In other words: Sell on a break of the low of the ‘Bar-Before-Entry’.

The code you helped me develop performs as intended except for one flaw.

As indicated on attached Barchart of my ‘Naked Bottom” system, the intended system sequence is as follows:
1. Market Position is MP=0 (Blue Dots on chart) until Entry Signal #1 is received.

2. Entry Signal #1 is received (Red Dot on chart) which initiates MP = 1 (Yellow Dots on chart) and signals a Long Trade.

3. Entry Signal #2 (Red Dot) is received and will continue with the original trade (Still MP = 1), but is expected to re-set the ‘Exit Trigger’ to < Entry Low [1] of Entry #2.

Note: In the case of Entry #2, the < Entry Low [1] of Entry #2 was not breached, and no exit was made (as was expected).

4. Entry Signal #3 (Red Dot) is received and continues the original trade (Still MP = 1), and (as discussed in Item 3 above) the ‘Exit Trigger’ is expected to be re-set to < Entry Low [1] of Entry #3.

Note: In the case of Entry #3, the < Entry Low [1] was breached, but no exit was made. Instead; many bars later, the actual exit (Green Dot) was made on the basis of < Entry Low [1] of Entry #1 (not Entry #3), whereupon Market Position was returned to MP=0 (Blue Dots on chart)

Question / Comment:
• How may I code my ‘Exit Trigger’ to re-calculate to the < Entry Low [1] for each succeeding Entry Signal, rather than the < Entry Low [1] of my initial entry?

Note: I do understand that a re-set depends on the Market Position reverting back to MP=0, when each new Entry Signal populates, but I cannot figure out how to make that happen.
My Indicator Code for attached BarChart is as follows:
Var:
MP(0),//MP = marketposition
BuyCondition (False),
bool NakedBtm ( false ),
double NakedBtmLow ( 0 );

//reset flag
NakedBtm = false ;
NakedBtm = NakedBtm or Condition1 and MP=0;

//trigger bar detected, store values
if NakedBtm then
begin
NakedBtmLow = 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];

//Buy Condition
BuyCondition = Condition1[1] and Condition2 and Condition3 or Condition4;

//Plots

//Long Entry
If BuyCondition then begin Plot2 (Low - .25, "LE", Red);
MP = 1;
End;

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

If MP=0 then Plot10 (HIGH + .75,"MP=0", blue);

If MP=1 then Plot11 (HIGH + .75,"MP=1", yellow);

As always, thank you sooo much for your expert guidance.

Attached Thumbnails
Future Reference to Past Bar-back-guru.bmp  
Reply With Quote
 
  #23 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,322 since Apr 2013
Thanks: 209 given, 746 received


Vientomarsol,

if I understand you correctly the problem you are facing spans from two things:

1. You need multiple different entries with each using its own stop value.
2. You only allow the stop value to be updated when you are flat.

You will most likely have to look into loops and arrays or use a list to accomplish what you want, be more convenient (although this would be a lot more complex due to the OOEL nature, though).

You basically need to update the NakedBtmLow every time the condition is met, but regardless of the market position. Then upon an entry signal store the current NakedBtmLow value in the list or array.
When you are currently in a position you have to loop through your list or array to check if the current price stopped any of your entries out, then you can remove this particular NakedBtmLow value from the list or array. This last part is where a list is more handy than the array for your problem, as removing entries is slightly simpler with lists (as you can simply shrink the list with removing entries, where the array would keep it's size and you'd manage the indices that have values within the array yourself).

This is definitely doable, but a bit more complex.

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #24 (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

You're The Man !!

ABCTG,

Thanks (as always) for your prompt response.

I knew there must be a tool I was missing, and OOEL is apparently it.
Looks like I’ve got my work cut-out for me, but I can imagine that OOEL will be a useful tool for future projects.

Again, thanks.


Respectfully,

Vientomarsol

Reply With Quote
The following user says Thank You to Vientomarsol 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)

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

May
 

EasyLanguage ABC's: Mastering TradeStation Programming w/Chris Kaiser

Elite only
 

Prototyping Python Strategies (part 2: Backtesting) w/Ran Aroussi [special time: 1PM ET]

Elite only
 

Portfolio Diversification w/Brendon Delate @ Diversify Portfolio

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

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 06:48 PM.

Copyright © 2017 by futures io, s.a. Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-05-23 in 0.12 seconds with 20 queries on phoenix via your IP 54.162.136.26