NexusFi: Find Your Edge


Home Menu

 





Plots fine on time charts but not on non-time based charts


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,904 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 10 posts
    2. attach_file 4 attachments




 
Search this Thread

Plots fine on time charts but not on non-time based charts

  #1 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011

Hi,

The following code plots fine on time based charts but not on non-time based charts like tick, range, volume, etc. The problem is that every time a new bar is formed, the lines do not continue to plot on any of the newly formed bars. On a minute chart, it plots fine. The only way I get it to update on non-time based charts is to turn the indicator off and then back on. Does anybody have any idea? I am using MultiCharts v9.0.

Thanks.

 
Code
Inputs:
	StartCalcTime		(0900),
	EndCalcTime		(0905),
	TLStartTime		(0900),
	TLEndTime		 (1430),
	yHigh			(101.00), 
	yLow			(100.00), 
	yClose			(100.50),
	A_Val			(.08),
	C_Val			(.13),
	PlaceTextRight	(true),
	Plot_All_Days		(False),
	HistoryCutoff		(1),
	IgnoreWeekends	(true),
	OR_Color		(white), 
	OR_Style		(2),  
	OR_LineSize		(0),
	A_Color		(Red), 
	A_Style		(2),  
	A_LineSize		(0),
	C_Color		(Cyan), 
	C_Style		(3),  
	C_LineSize		(1),
	PP_Color		(yellow), 
	PP_Style		(2),  
	PP_LineSize		(1),
	yHighLow_Color	(darkgray),
	yHighLow_Style	(3),
	yHighLow_LineSize	(2),
	yClose_Color		(darkred),
	yCLose_Style		(3),
	yClose_LineSize	(2),
	Font_Name		("Arial"),
	Font_Size		(9);
		
Variables:
	Monday2Friday		(false),
	A_Up			(0),
	C_Up			(0),
	A_Down			(0),
	C_Down			(0),
	PP			(0),
	PV			(0), 
	PVR			(0),
	ORHighTL		(0),
	ORLowTL		(0),
	A_UPTL 		(0),
	C_UPTL			(0),
	A_DownTL		(0),
	C_DownTL 		(0),
	PPTL			(0),
	PVRHighTL		(0),
	PVRLowTL		(0),
	yHighTL		(0),
	yLowTL			(0),
	yCloseTL		(0),
	DayHi			(-999999),
	DayLo			(+999999),
	HaveTLs		(false),
	HaveLevels		(false),
	StartTime		(0),
	EndTime		(0),
	ORHighTxt		(0),
	ORLowTxt		(0),	
	A_UPTxt		(0),
	C_UpTxt		(0),
	A_DownTxt		(0),
	C_DownTxt		(0),
	PPTxt			(0),
	PVRHighTxt		(0),
	PVRLowTxt		(0),
	YHighTxt		(0),
	YLowTxt		(0),
	YCloseTxt		(0),
	SessClose		(0);
			
	If (Plot_All_Days OR D >= Currentdate - HistoryCutoff) then
		begin

	If IgnoreWeekends then begin
		If DayOfWeek(Date) >= Monday and DayOfWeek(Date) <= Friday then 
			Monday2Friday = true
		else 
			Monday2Friday = false;
	
	end
	else begin
		Monday2Friday = true;
	end;
			
	If Monday2Friday then begin
	
		If Date <> Date[1] then
			HaveLevels = false;
			HaveTLs = false;
	
		end; //If Date <> Date[1] then begin...	
	
		If Time > StartCalcTime and Time <= EndCalcTime then begin
			If High >= DayHi then DayHi = High;
			If Low <= DayLo then DayLo = Low;
		end;//If Time > StartCalcTime and Time <= EndCalcTime then begin...
		
		if Time > EndCalcTime and HaveLevels = false then
		begin 
			HaveLevels = true;
	
		If HaveTLs = false then begin
			HaveTLs = true;
					
			A_UP = DayHi + A_Val;
			C_UP = DayHi + C_Val;
			A_Down = DayLo - A_Val;
			C_Down = DayLo - C_Val;
			PP = (yHigh + yLow + yClose ) /3;
			PV = (yHigh + yLow) /2;
			PVR = (PP - PV); //Pivot Range Value
			
			ORHighTL = TL_New(Date, TLStartTime, DayHi, Date, TLEndTime, DayHi);
				TL_SetColor(ORHighTL, OR_Color);
				TL_SetSize(ORHighTL, OR_LineSize);	
				TL_SetStyle(ORHighTL, OR_Style);
				
			ORLowTL = TL_New(Date, TLStartTime, DayLo, Date, TLEndTime, DayLo);
				TL_SetColor(ORLowTL, OR_Color);
				TL_SetSize(ORLowTL, OR_LineSize);	
				TL_SetStyle(ORLowTL, OR_Style);
			
			A_UpTL = TL_New(Date, TLStartTime, A_UP, Date, TLEndTime, A_UP);
				TL_SetColor(A_UPTL, A_Color);
				TL_SetSize(A_UPTL, A_LineSize);	
				TL_SetStyle(A_UPTL, A_Style);			
			
			C_UPTL = TL_New(Date, TLStartTime, C_UP, Date, TLEndTime, C_UP);
				TL_SetColor(C_UPTL, C_Color);
				TL_SetSize(C_UPTL, C_LineSize);	
				TL_SetStyle(C_UPTL, C_Style);
						
			A_DownTL = TL_New(Date, TlStartTime, A_Down, Date, TLEndTime, A_Down);
				TL_SetColor(A_DownTL, A_Color);
				TL_SetSize(A_DownTL, A_LineSize);	
				TL_SetStyle(A_DownTL, A_Style);
				
			C_DownTL = TL_New(Date, TLStartTime, C_Down, Date, TLEndTime, C_Down);
				TL_SetColor(C_DownTL, C_Color);
				TL_SetSize(C_DownTL, C_LineSize);	
				TL_SetStyle(C_DownTL, C_Style);
				
			PPTL = TL_New(Date, TLStartTime, PP, Date, TLEndTime, PP);
				TL_SetColor(PPTL, PP_Color);
				TL_SetSize(PPTL, PP_LineSize);	
				TL_SetStyle(PPTL, PP_Style);
				
			PVRHighTL = TL_New(Date, TLStartTime, PP + PVR, Date, TLEndTime, PP + PVR);
				TL_SetColor(PVRHighTL, PP_Color);
				TL_SetSize(PVRHighTL, PP_LineSize);	
				TL_SetStyle(PVRHighTL, PP_Style);
									
			PVRLowTL = TL_New(Date, TLStartTime, PP - PVR, Date, TLEndTime, PP - PVR);
				TL_SetColor(PVRLowTL, PP_Color);
				TL_SetSize(PVRLowTL, PP_LineSize);	
				TL_SetStyle(PVRLowTL, PP_Style);
				
			yHighTL = TL_New(Date, TLStartTime, yHigh, Date, TLEndTime, yHigh);
				TL_SetColor(yHighTL, yHighLow_Color);
				TL_SetSize(yHighTL, yHighLow_LineSize);	
				TL_SetStyle(yHighTL, yHighLow_Style);
				
			yLowTL = TL_New(Date, TLStartTime, yLow, Date, TLEndTime, yLow);
				TL_SetColor(yLowTL, yHighLow_Color);
				TL_SetSize(yLowTL, yHighLow_LineSize);	
				TL_SetStyle(yLowTL, yHighLow_Style);
				
			yCloseTL = TL_New(Date, TLStartTime, yClose, Date, TLEndTime, yClose);
				TL_SetColor(yCloseTL, yClose_Color);
				TL_SetSize(yCloseTL, yClose_LineSize);	
				TL_SetStyle(yCloseTL, yClose_Style);						
															
			ORHighTxt = Text_New(Date, TLStartTime, DayHi, "OR High");
				Text_SetStyle(ORHighTxt, 1, 1);
				Text_SetColor(ORHighTxt, OR_Color);
				Text_SetFontName(ORHighTxt, Font_Name); 
				Text_SetSize(ORHighTxt, Font_Size);
	
			ORLowTxt = Text_New(Date, TLStartTime, DayLo, "OR Low");
				Text_SetStyle(ORLowTxt, 1, 1);	
				Text_SetColor(ORLowTxt, OR_Color);
				Text_SetFontName(ORLowTxt, Font_Name); 
				Text_SetSize(ORLowTxt, Font_Size);
			
			A_UPTxt = Text_New(Date, TLStartTime, A_UP, "A Up");
				Text_SetStyle(A_UPTxt, 1, 1);
				Text_SetColor(A_UPTxt, A_Color);
				Text_SetFontName(A_UPTxt, Font_Name); 
				Text_SetSize(A_UPTxt, Font_Size);
						
			C_UpTxt = Text_New(Date, TLStartTime, C_Up, "C Up");
				Text_SetStyle(C_UpTxt, 1, 1);	
				Text_SetColor(C_UpTxt, C_Color);
				Text_SetFontName(C_UPTxt, Font_Name); 
				Text_SetSize(C_UPTxt, Font_Size);
				
			A_DownTxt = Text_New(Date, TLStartTime, A_Down, "A Down");
				Text_SetStyle(A_DownTxt, 1, 1);	
				Text_SetColor(A_DownTxt, A_Color);
				Text_SetFontName(A_DownTxt, Font_Name); 
				Text_SetSize(A_DownTxt, Font_Size);
				
			C_DownTxt = Text_New(Date, TLStartTime, C_Down, "C Down");
				Text_SetStyle(C_DownTxt, 1, 1);	
				Text_SetColor(C_DownTxt, C_Color);
				Text_SetFontName(C_DownTxt, Font_Name); 
				Text_SetSize(C_DownTxt, Font_Size);
				
			PPTxt = Text_New(Date, TLStartTime, PP, "PP");
				Text_SetStyle(PPTxt, 1, 1);	
				Text_SetColor(PPTxt, PP_Color);
				Text_SetFontName(PPTxt, Font_Name); 
				Text_SetSize(PPTxt, Font_Size);
				
			PVRHighTxt = Text_New(Date, TLStartTime, PP + PVR, "PR High");
				Text_SetStyle(PVRHighTxt, 1, 1);	
				Text_SetColor(PVRHighTxt, PP_Color);
				Text_SetFontName(PVRHighTxt, Font_Name); 
				Text_SetSize(PVRHighTxt, Font_Size);
				
			PVRLowTxt = Text_New(Date, TLStartTime, PP - PVR, "PR Low");
				Text_SetStyle(PVRLowTxt, 1, 1);	
				Text_SetColor(PVRLowTxt, PP_Color);
				Text_SetFontName(PVRLowTxt, Font_Name); 
				Text_SetSize(PVRLowTxt, Font_Size);
				
			yHighTxt = Text_New(Date, TLStartTime, yHigh, "Y High");
				Text_SetStyle(YHighTxt, 1, 1);	
				Text_SetColor(YHighTxt, yHighLow_Color);
				Text_SetFontName(YHighTxt, Font_Name); 
				Text_SetSize(YHighTxt, Font_Size);
				
			yLowTxt = Text_New(Date, TLStartTime, yLow, "Y Low");
				Text_SetStyle(YLowTxt, 1, 1);	
				Text_SetColor(YLowTxt, yHighLow_Color);
				Text_SetFontName(YLowTxt, Font_Name); 
				Text_SetSize(YLowTxt, Font_Size);
				
			yCloseTxt = Text_New(Date, TLStartTime, yClose, "Y Close");
				Text_SetStyle(YCloseTxt, 1, 1);	
				Text_SetColor(YCloseTxt, yClose_Color);
				Text_SetFontName(YCloseTxt, Font_Name); 
				Text_SetSize(YCloseTxt, Font_Size);
				
			If PlaceTextRight then begin
				Text_SetLocation(ORHighTxt, Date, TLEndTime, DayHi);
				Text_SetLocation(ORLowTxt, Date, TLEndTime, DayLo);
				Text_SetLocation(A_UPTxt, Date, TLEndTime, A_Up);
				Text_SetLocation(C_UPTxt, Date, TLEndTime, C_Up);
				Text_SetLocation(A_DownTxt, Date, TLEndTime, A_Down);
				Text_SetLocation(C_DownTxt , Date, TLEndTime, C_Down);
				Text_SetLocation(PPTxt, Date, TLEndTime, PP);
				Text_SetLocation(PVRHighTxt, Date, TLEndTime, PP + PVR);
				Text_SetLocation(PVRLowTxt, Date, TLEndTime, PP - PVR);
				Text_SetLocation(yHighTxt, Date, TLEndTime, yHigh);
				Text_SetLocation(yLowTxt, Date, TLEndTime, yLow);
				Text_SetLocation(yCloseTxt, Date, TLEndTime, yClose);
			
			end; //If PlaceTextRight then begin...
															
		end; //If HaveTLs = false then begin...
	
	end; //If Monday2Friday then begin...

	If (Time > TLEndTime and Time[1] <= TLEndTime) then begin
		DayHi = -999999;
		DayLo = 999999;
	end; //If (Time > TLEndTime and Time[1] <= TLEndTime) then begin
	end; //If (Today_Only OR D >= Currentdate - HistoryCutoff) then begin

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
Increase in trading performance by 75%
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
29 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
10 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


olobay,

I tried it on a 1 min @ES# chart in MC9 and it didn't plot anything here, 5 days back and using your default settings.
There also seems something off in the code, if you look at the image, the date reset only affects the HaveLevels flag, which is not even used in the code. That makes the second market part obsolete in my opinion.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011


ABCTG View Post
olobay,

I tried it on a 1 min @ES# chart in MC9 and it didn't plot anything here, 5 days back and using your default settings.
There also seems something off in the code, if you look at the image, the date reset only affects the HaveLevels flag, which is not even used in the code. That makes the second market part obsolete in my opinion.

Regards,
ABCTG

For some reason on the weekend, the only way to get it to plot is to change the Plot All Days to True. But the code works fine when trading starts except that it doesn't update on non-time based charts.

Started this thread Reply With Quote
  #5 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011

@ABCTG,

Even your 24hrPivots indicator doesn't update the lines on new bars on tick charts. The chart below shows what I mean. You might think it's a case of the EndCalcTime but my issue has no bearing on it. It could be set to any time and it doesn't update on new bars for tick charts. Can you reproduce this issue on your end?


Started this thread Reply With Quote
  #6 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011

This is the ES. Indicator is set to update every tick. 2000 tick chart.


Started this thread Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

olobay,

what settings are you using? It looks different on my end with the default settings.

Regards,
ABCTG


olobay View Post
This is the ES. Indicator is set to update every tick. 2000 tick chart.



Follow me on Twitter Reply With Quote
Thanked by:
  #8 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011

The PlotToDateEnd does not make a difference for me whether it's true or false.


Started this thread Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

olobay,

thanks, I have been able to reproduce it and I have started to create a new version that addresses those issues and allows for more flexibility with the time settings for example. However it upsets me that studies I give out for free are taken and sold by others - which on the one hand is a compliment of sorts, but the upsetting part is that someone pays for something intended to be free.
The work around would be to only post the closed code, which also has it's cons and I haven't decided on the best approach, yet.

Regards,
ABCTG


olobay View Post
The PlotToDateEnd does not make a difference for me whether it's true or false.



Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
 olobay 
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: DeepDiscountTrading.com
Trading: CL
Posts: 364 since Jul 2011



ABCTG View Post
olobay,

thanks, I have been able to reproduce it and I have started to create a new version that addresses those issues and allows for more flexibility with the time settings for example. However it upsets me that studies I give out for free are taken and sold by others - which on the one hand is a compliment of sorts, but the upsetting part is that someone pays for something intended to be free.
The work around would be to only post the closed code, which also has it's cons and I haven't decided on the best approach, yet.

Regards,
ABCTG

Anything new on making the indicator work on non time based charts?

Started this thread Reply With Quote




Last Updated on April 26, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts