How to fix the data offset with Timeframeset - AmiBroker | futures io social day trading
futures io futures trading


How to fix the data offset with Timeframeset
Updated: Views / Replies:84 / 0
Created: by pradeep5344 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 100,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 fix the data offset with Timeframeset

  #1 (permalink)
San Diego
 
 
Posts: 1 since Sep 2019
Thanks: 0 given, 0 received

How to fix the data offset with Timeframeset

Hello,

I am trying to have a strategy where i want to access daily/hourly TF data on a 5 mins chart.
While doing so, i am seeing incorrect data its fetching.
Can you let me know how can i fix it within the code?

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


when i mean highest and lowest of candle in 5 mins chart.
High has to be hhv of current day only when in daily timeframe and Highest of current hour only when in hourly timeframe
Low has to be llv of current day only when in daily timeframe and Lowest of current hour only when in hourly timeframe
Close has to be latest 5 min candle close value

Daily data has to be:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



I did try the TimeFrameSet function for this, and tried to fetch data with Timeframeexpand to verify data in explorations. I might be missing lot of things while doing so, so wanted some help to get it right.

Here is full code.
Descriptions: having the code to display strength of the price action. Added custom timeframe calculation to enable higher timeframe plot on 5 mins chart, but its not showing me same data when i used custom timeframe(hourly/daily) in 5 mins chart,as i use custom(in hourly/ in daily) timeframe on separate chart or standalone

HTML Code:
SetOption( "WarningLevel", 1 );

Plot(100,"Upper Limit",colorBlack,styleDashed);
Plot(-100,"Lower Limit",colorBlack,styleDashed);
debug			= ParamToggle( "Enable Debug Mode"	, "False|True"	, 1);
show_mtf		= ParamToggle( "Show both Mutiple-Timeframe + Current TF plots"		, "False|True"	, 1);
use_same_period		= ParamToggle( "Use same period for all timeframes"	, "False|True"	, 1);

_SECTION_BEGIN("Current Timeframe");
potential_period = Param      ("Periods", 9, 1, 200, 1 );
current_style 	 = ParamStyle ("Style of Current TF");
gainPotential 	 = ParamColor ("Gaining Potential" , colorGreen);
loosPotential 	 = ParamColor ("Loosing Potential" , colorRed  );
changePotential  = ParamColor ("Changing Potential", colorBlue );

ys1	=	(High+Low+Close*2)/4;
rk3	=	EMA(ys1,potential_period);
rk4	=	StDev(ys1,potential_period);
rk5	=	(ys1-rk3)*100/rk4;
rk6	=	EMA(rk5,potential_period);
UP	=	EMA(rk6,potential_period);
DOWN 	=  	EMA(up,potential_period);
Oo	=	IIf(up<down,up,down);
Hh	=	Oo;
Ll	=	IIf(up<down,down,up);
Cc	=	Ll;
barcolor2		=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),changePotential,  IIf(up>down,gainPotential,loosPotential ));
ribbon_color 	=IIf(Ref(oo,-1)<Oo AND Cc<Ref(Cc,-1),changePotential , IIf(up>down,gainPotential,IIf( down>up, loosPotential , changePotential )));

if (show_mtf) {
	PlotOHLC(Oo,hh,ll,Cc, "Current" + Name(), barcolor2, current_style );
	Plot(1,"ribbon",ribbon_color,styleOwnScale|styleArea|styleNoLabel, -01, 50 );
}

_SECTION_END();

_SECTION_BEGIN("Custom Timeframe");

potential_tf 	 	= ParamList  ("Custom TimeFrames (default is Daily)", "in1Minute|in5Minute|in15Minute|in30Minute|inHourly|in75Minute|in90Minute|inDaily|inWeekly|inMonthly", 7);
tf_potential_period = Param      ("Custom TimeFrame Periods", 9, 1, 200, 1);
custom_plot_width   = Param      ("Custom Plot Width"       , 2, 1,  15, 1);
custom_style 	 	= ParamStyle ("Style Custom TF");
tf_gainPotential 	= ParamColor ("Gaining Potential" , colorDarkGreen);
tf_loosPotential 	= ParamColor ("Loosing Potential" , colorDarkRed  );
tf_changePotential 	= ParamColor ("Changing Potential", colorDarkBlue );

switch (potential_tf) {
    case "in1Minute"	: tf = in1Minute	; break;
    case "in5Minute"	: tf = in5Minute	; break;
    case "in15Minute"	: tf = in15Minute	; break;
    case "in30Minute"	: tf = 2*in15Minute	; break;
    case "in45Minute"	: tf = 3*in15Minute	; break;
    case "inHourly"		: tf = inHourly		; break;
    case "in75Minute"	: tf = 5*in15Minute	; break;
    case "in90Minute"	: tf = 6*in15Minute	; break;
    case "inDaily"		: tf = inDaily		; break;
    case "inWeekly"		: tf = inWeekly		; break;
    case "inMonthly"	: tf = inMonthly	; break;
    default				: tf = inDaily		; break;
}

if (use_same_period) {
	tf_potential_period = potential_period;
}

TimeFrameSet( tf ); // switch now to specified timeframes

	tf_close = Ref(C, 1);
	tf_ys1	=	(High+Low+tf_close*2)/4;
	tf_rk3	=	EMA(tf_ys1,		tf_potential_period);
	tf_rk4	=	StDev(tf_ys1,	tf_potential_period);
	tf_rk5	=	(tf_ys1-tf_rk3)*100/tf_rk4;
	tf_rk6	=	EMA(tf_rk5,		tf_potential_period);
	tf_UP	=	EMA(tf_rk6,		tf_potential_period);
	tf_DOWN =   EMA(tf_up,		tf_potential_period);
	tf_Oo	=	IIf(tf_up < tf_down, tf_up, tf_down);
	tf_Hh	=	tf_Oo;
	tf_Ll	=	IIf(tf_up < tf_down, tf_down, tf_up);
	tf_Cc	=	tf_Ll;
	tf_barcolor2 = IIf(Ref(tf_oo,-1)<tf_Oo AND tf_Cc<Ref(tf_Cc,-1), tf_changePotential, IIf( tf_up>tf_down, tf_gainPotential, tf_loosPotential ));
	tf_rib_color = IIf(Ref(tf_oo,-1)<tf_Oo AND tf_Cc<Ref(tf_Cc,-1), tf_changePotential, IIf( tf_up>tf_down, tf_gainPotential, IIf( tf_down>tf_up, tf_loosPotential, tf_changePotential )));
if (debug) {
	AddColumn(H			,"Inside High"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(L			,"Inside Low"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(C			,"Inside Close" 		,  1.2 , colorDefault , colorDefault);
	}
TimeFrameRestore(); 

mtf_Oo 		   	 = TimeFrameExpand (tf_Oo		, tf);
mtf_Hh 		  	 = TimeFrameExpand (tf_Hh		, tf);
mtf_Ll 		  	 = TimeFrameExpand (tf_Ll		, tf);
mtf_Cc 		  	 = TimeFrameExpand (tf_Cc		, tf);
mtf_close	  	 = TimeFrameExpand (Close		, tf);
mtf_barcolor2 	 = TimeFrameExpand (tf_barcolor2, tf);
mtf_ribbon_color = TimeFrameExpand (tf_rib_color, tf);

Plot(mtf_Cc, "TimeFrame" + Name(), mtf_barcolor2, custom_style, Null, Null, 0 , 0, custom_plot_width );
Plot(2,"ribbon", mtf_ribbon_color,styleOwnScale|styleArea|styleNoLabel, -300, 20 );

if (debug) {
	Filter = 1;
	AddColumn(H			,"High"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(L			,"Low"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(C			,"Close" 		,  1.2 , colorDefault , colorDefault);
	AddColumn(Cc		,"Pot Close"	,  1.2 , barcolor2	  , colorDefault);
	
	AddColumn(TimeFrameExpand(H, tf)			,"TF High"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(L, tf)			,"TF Low"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(C, tf)			,"TF Close" 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(H, tf)			,"EL TF High"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(L, tf)			,"EL TF Low"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(C, tf)			,"EL TF Close" 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_Close, tf)		,"TF1 Close" 		,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_ys1, tf)		,"TF ys1"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_rk3, tf)		,"TF rk3"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_rk4, tf)		,"TF rk4"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_rk5, tf)		,"TF rk5"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_rk6, tf)		,"TF rk6"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_UP, tf)		,"TF UP"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_DOWN, tf)		,"TF DOWN"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_Oo, tf)		,"TF Oo"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_Hh, tf)		,"TF Hh"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_Ll, tf)		,"TF Ll"			,  1.2 , colorDefault , colorDefault);
	AddColumn(TimeFrameExpand(tf_Cc, tf)		,"TF Pot Close"	,  1.2 , barcolor2	  , colorDefault);
	AddColumn(TimeFrameExpand(tf_barcolor2, tf)	,"TF Barcolor2"	,  1.2 , barcolor2	  , colorDefault);
	AddColumn(TimeFrameExpand(Ref(C, 1), tf)	,"TF Close"	 		,  1.2 , colorDefault , colorDefault);
	AddColumn(mtf_Cc	,"MTF Pot Close",  1.2 , mtf_barcolor2, colorDefault);
}

_SECTION_END();
-Thanks


Last edited by pradeep5344; September 25th, 2019 at 04:19 AM.
Reply With Quote

Reply



futures io > > > > How to fix the data offset with Timeframeset

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Webinar: The Seven Most Effective Trading Setups w/Peter Davies @ Jigsaw

Oct 17
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
FXCM historical data has DST offset in raw "UTC" data noetus Reviews of Brokers and Data Feeds 2 October 19th, 2015 06:17 AM
offset on a losing trading day - like hedging emini_Holy_Grail Traders Hideout 3 October 27th, 2012 05:59 PM
JPMorgan dips into cookie jar to offset "London Whale" losses kbit News and Current Events 0 May 29th, 2012 09:05 AM
Reconstruction Won't Offset Irene Losses: Economist Quick Summary News and Current Events 0 August 29th, 2011 08:10 AM
OrderType.StopLimit offset parameter in strategy? gain247 NinjaTrader Programming 2 August 18th, 2011 09:15 PM


All times are GMT -4. The time now is 08:01 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 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