Rewriting DATE NEXT BAR <> DATE - Simple Help - Traders Hideout | futures io social day trading
futures io futures trading


Rewriting DATE NEXT BAR <> DATE - Simple Help
Updated: Views / Replies:477 / 7
Created: by fiverr 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
 

Rewriting DATE NEXT BAR <> DATE - Simple Help

  #1 (permalink)
Elite Member
Calgary
 
Futures Experience: None
Platform: TradeStation, MT4
Favorite Futures: ES, Stocks
 
Posts: 73 since Aug 2015
Thanks: 4 given, 10 received

Rewriting DATE NEXT BAR <> DATE - Simple Help

Hi there,

I have the following simple problem

 
Code
DATE NEXT BAR <> DATE
How can I rewrite the code so that it does not use NEXT BAR?

I tried DATE <> DATE[1] but it does not behave the same.

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,524 since Apr 2013
Thanks: 229 given, 852 received
Forum Reputation: Legendary


fiverr,

someone might be able to help you, if you could elaborate what you are trying to accomplish.

A correct answer to your question (although obviously not what you want) would be:

 
Code
Date <> Date
This would be the code re-written, without using next bar - taking your question literally.

As another person usually doesn't know your intend, it's extremely helpful to provide as much context and explanations as possible - what does the code do now, what do you want it to do instead etc.. If you want people being able to help you, it can also make sense to state the platform you want the help for and post into the correct section of the forum.
Just to make it clear, I am trying to help and the above is meant as that and no criticism.

When you apply the following code (in a signal) to an intraday chart, you will see why the two are different:
 
Code
If Date <> Date[1] then
	Print( BarDateTime.Format( "%m-%d-%y  %H:%M" ), "; Date <> Date[1]", "; BarNumber: ", CurrentBar ) ;       
	
if Date next bar <> Date then
	Print( BarDateTime.Format( "%m-%d-%y  %H:%M" ), "; Date next bar <> Date", "; BarNumber: ", CurrentBar ) ;
Date <> Date[1] will become true on the first bar of the new day, while Date next bar <> Date is true on the last bar of the current day already (as at that time the date of the NEXT BAR is already the next date).

One approach might be to change the codes that are affected by that, so they give you the same results when using Date <> Date[1].

Regards,

ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #4 (permalink)
Elite Member
Calgary
 
Futures Experience: None
Platform: TradeStation, MT4
Favorite Futures: ES, Stocks
 
Posts: 73 since Aug 2015
Thanks: 4 given, 10 received


ABCTG View Post


Date <> Date[1] will become true on the first bar of the new day, while Date next bar <> Date is true on the last bar of the current day already (as at that time the date of the NEXT BAR is already the next date).

One approach might be to change the codes that are affected by that, so they give you the same results when using Date <> Date[1].

Regards,

ABCTG

ABCTG,

Thanks for the tips. I am currently using Multichart and I had to change your code.

 
Code
print(datetimetostring_ms(datetime_bar_update));


If Date <> Date[1] then
	Print( datetimetostring_ms(datetime_bar_update), "; Date <> Date[1]", "; BarNumber: ", CurrentBar ) ;       
	
//if Date next bar <> Date then
if Date next bar <> Date then
	Print( datetimetostring_ms(datetime_bar_update), "; Date next bar <> Date", "; BarNumber: ", CurrentBar ) ;
Below are my output:

2015-08-25 15:00:00.000
2015-08-25 15:15:00.000
2015-08-25 15:15:00.000; Date next bar <> Date; BarNumber: 51268.00
2015-08-26 09:00:00.000
2015-08-26 09:00:00.000; Date <> Date[1]; BarNumber: 51269.00
2015-08-26 09:30:00.000

Below is my original strategy that is running on 30M chart.

 
Code
if DATE NEXT BAR <> DATE OR ATR_check = FALSE then
   Begin
      if DATE NEXT BAR <> DATE then
      Begin
         average_20C = Average (CLOSE, 20);
      End ;
      prev_ATR_check = ATR_check ;
   End ;
I would like to modify the above code to do 2 things: 1) run on the 1M chart but still referencing the 30M logic 2) to avoid using "DATE NEXT BAR".

Your help is greatly appreciated.

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,524 since Apr 2013
Thanks: 229 given, 852 received
Forum Reputation: Legendary

fiverr,

what exactly do you mean with "still referencing the 30M logic" exactly? What should it apply to and what not?

If you are running your strategy without intrabar order generation on a 30 min chart, you have access to the values at the end of that 30 min bar. This is something you can't overcome, unless you are willing to act on values that might be different than they would be at the end of the bar. Take the average for example: Over the course of the bar it will have different values. Your current signal acts on the end of bar values for that average, but if you are trying to act on the average's values already mid bar for example, the results will likely be different than in your original strategy (simply because you are looking at different data).

You also might want to do @BigMike a favor and not post the same questions multiple times across different threads.

Regards,

ABCTG

Reply With Quote
 
  #6 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,524 since Apr 2013
Thanks: 229 given, 852 received
Forum Reputation: Legendary

This is what I meant under #3, it's very hard to understand what you are trying to accomplish with the information you provide:

MultiCharts: Trading Software for Automated Trading and Backtesting ? View topic - Rewriting DATE NEXT BAR <> DATE

Reply With Quote
 
  #7 (permalink)
Elite Member
Calgary
 
Futures Experience: None
Platform: TradeStation, MT4
Favorite Futures: ES, Stocks
 
Posts: 73 since Aug 2015
Thanks: 4 given, 10 received


ABCTG View Post
fiverr,

what exactly do you mean with "still referencing the 30M logic" exactly? What should it apply to and what not?


Regards,

ABCTG


ABCTG,

I did not want to scare readers by posting a large amount of code so I tried to keep it as simple as possible. It backed fire on me. Anyhow, you have helped me out a lot and I think that I got a temporary solution. Before I was attaching the code to the 30M chart, using the code below I am attaching the code to 1M chart. This is what I mean by using 1M chart but referencing 30M chart.

Data1 - 1M chart
Data2 - 30M chart

 
Code
Variables: average_20C(0, data(2));

if Time >= 1500 OR ATR_check = FALSE then
   Begin
      if Time >= 1500 then
      Begin
         average_20C = Average (CLOSE, 20)of data(2);
      End ;
      prev_ATR_check = ATR_check ;
   End ;

Reply With Quote
 
  #8 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,524 since Apr 2013
Thanks: 229 given, 852 received
Forum Reputation: Legendary

fiverr,

you are welcome. You might want to specify that the average should use the Data 2 Close, although for the closing price this might not even matter (for High and Low for example it will, though, as these will be different).

 
Code
average_20C = Average (CLOSE Data2, 20)of data(2);
Regards,

ABCTG

Reply With Quote

Reply



futures io > > > Rewriting DATE NEXT BAR <> DATE - Simple Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to collaborate on an ETF<->Futures delevering bender? hobart Sierra Chart Programming 1 August 11th, 2015 06:35 PM
Rollover date vs Expiration date grego Currency Futures 3 March 10th, 2014 07:03 AM
BLUELINE DELIGHT >>>Intraday Trading Strategy Guide<<< Gabriyele The Elite Circle 407 May 30th, 2013 08:29 AM
'From' date needs to be smaller than 'To' date DavidHP NinjaTrader Programming 2 January 3rd, 2010 11:09 PM


All times are GMT -4. The time now is 10:27 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-12-10 in 0.11 seconds with 19 queries on phoenix via your IP 54.221.73.186