How to reference historical price bars by time v2 - EasyLanguage Programming | futures io social day trading
futures io futures trading


How to reference historical price bars by time v2
Updated: Views / Replies:396 / 2
Created: by mandelmus Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

How to reference historical price bars by time v2

  #1 (permalink)
Trading Apprentice
Dallas, TX
 
Futures Experience: Advanced
Platform: TS, MS, SF, ToS
Favorite Futures: Forex, Stocks
 
Posts: 8 since Jun 2011
Thanks: 2 given, 3 received

How to reference historical price bars by time v2

I'm trying to develop a lunch-time lull range breakout strategy. In order to do that, I need to do some calculations based on referencing historical price bars by time.

I followed the suggestions posted on a related thread ... "How to reference historical price bars by time" ... but it was insufficient. The code works fine up until 1100 today. When it hits 1100 today, the code seems to calculate the difference between the price at 1300 yesterday and 1100 today (instead of yesterday). I want it to reference 1100 and 1300 from the previous day instead of the current day.

 
Code
[IntrabarOrderGeneration = TRUE]

Variables:
    storedClose1(0),
    storedClose2(0),
    storedClose3(0);
    
// Store close of a specific time    
if (Time = 1100) then  // supposed to be for 1100 of previous day
    storedClose1 = Close;
if (Time = 1300) then  // supposed to be for 1300 of previous day
    storedClose2 = Close;
if (Time = 1130) then  // supposed to be for 1130 of current day
    storedClose3 = Close;

// Compare it with the current close
if (Time >= 1130) and ( Close > ( (storedClose2 - storedClose1) + storedClose3 ) ) then
    Buy next bar at market;

Here is my vision ...

1) Calculate the price difference between the following:
... a) Price at 1100 CST of the previous trading day (roughly the beginning of the lunch-time lull)
... b) Price at 1300 CST of the previous trading day (roughly the end of the lunch-time lull)
... c) For example: $25 price at 1300 yesterday - $20 price at 1100 yesterday = +$5 difference

2) If the price difference is positive:
... a) I would draw a trendline at the level of the price at 1130 (1130am CST today) + the price difference
... b) I would enter long if intrabar price crosses above the trendline ... I would exit at 2% profit or set a stop loss at 5%
... c) For example: $30 price at 1130 today + $5 difference = enter long if price crosses above $35 and set exit at either 2% profit or 5% stop loss

3) If the price difference is negative:
... a) I would draw a trendline at the level of the price at 1130 (1130am CST today) - the price difference
... b) I would enter short if intrabar price crosses below the trendline ... I would exit at 2% profit or set a stop loss at 5%
... c) For example: $30 price at 1130 today - $5 difference = enter short if price crosses below $25 and set exit at either 2% profit or 5% stop loss

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 855 received
Forum Reputation: Legendary


mandelmus,

the way you wrote the code TS has no way of knowing that you want to use the value at the same time of the last day. So you need to store the value yourself on the current day and use it on the next day.

something like this should get you going:

 
Code
Variables:
   currentClose1(0),
   currentClose2(0),
    storedClose1(0),
    storedClose2(0),
    storedClose3(0);
    
// Store close of a specific time    
if (Time = 1100) then  // supposed to be for 1100 of previous day
begin
    storedClose1 = currentClose1 ;
    currentClose1 = Close ;
end ;
if (Time = 1300) then  // supposed to be for 1300 of previous day
begin
    storedClose2 = currentClose2 ;
    currentClose2 = Close ;
end ;
if (Time = 1130) then  // supposed to be for 1130 of current day
    storedClose3 = Close;
Regards,
ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:

Reply



futures io > > > > > How to reference historical price bars by time v2

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting closing orders (i.e. limit/stop) that reference Buy_to_open price mish ThinkOrSwim Programming 1 October 28th, 2014 10:43 AM
tried to reference too many bars back malibu TradeStation 4 June 2nd, 2014 04:33 PM
How to reference historical price bars by time billtf EasyLanguage Programming 4 February 25th, 2012 02:05 AM
How to reference Session template Price/Time? forrestang NinjaTrader Programming 8 November 24th, 2011 01:05 PM
FisherTransform - able to reference the bars that FisherTransform Indicator produces Zipper Ripper NinjaTrader Programming 5 July 9th, 2011 07:03 PM


All times are GMT -4. The time now is 07:16 AM.

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-12-16 in 0.08 seconds with 19 queries on phoenix via your IP 54.226.113.250