NexusFi: Find Your Edge


Home Menu

 





Volume Breakdown / Cumulative Delta Momentum Print indicator - text float problem


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Rockford with 5 posts (1 thanks)
    2. looks_two ABCTG with 5 posts (1 thanks)
    3. looks_3 treydog999 with 4 posts (0 thanks)
    4. looks_4 SPMC with 3 posts (2 thanks)
    1. trending_up 10,941 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 18 posts
    2. attach_file 2 attachments




 
Search this Thread

Volume Breakdown / Cumulative Delta Momentum Print indicator - text float problem

  #1 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039

Alright so I have created a VB style print that plots in text the cumulative delta momentum (single bar value) on the bottom of the chart. However there is a slight problem, the float only works for bars created real time. other wise it just puts it some displacement from the bar. I want it to float all the time. But none the less this indicator works, its only the aesthetics that are messed up.

Basically you put cumulative delta as data 1/2/3, use data select input to set that. then it will plot at the bottom of your candle chart the delta of that bar.

If someone could tell me how to float historical text objects so they all line up that would be awesome
 
Code
input: Upcolor(rgb(73, 120, 168)), downcolor(rgb(168, 73, 96)),
 NeutralColor(lightgray), TickDisplace( .0005 ), textsize(10), dataselect(3), screenpercent(5);
vars: Cvalue( 0 );

//data and calcs
if dataselect = 1 then
Cvalue = close of data1 - open of data1;

if dataselect = 2 then
Cvalue = close of data2 - open of data2;

if dataselect = 3 then
Cvalue = close of data3 - open of data3;

//Plot text
value1 = text_new(date,time,low - Tickdisplace, numtostr(Cvalue,0));

//stylize text
text_setstyle(value1,2,1);	
text_setsize(value1,textsize);

if cvalue > 0 then
	text_setcolor(value1,upcolor)
else
	text_setcolor(value1,downcolor);
	
value2 = text_Float(value1,0,screenpercent);
note:
if i do last bar and float them with a last bar flag. then it wont display historical values but all of them will be lined up as only bars the platform was here for are printed.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Request for MACD with option to use different MAs for fa …
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
49 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


Hi treydog999,

this will probably take a little bit of programming.

When you use RecalcLastBarAfter, aiHighestDispValue and aiLowestDispValue that are used within the Text_Float function to return the highest and
lowest value for the currently displayed screen, will work on historical bars, too.
This alone doesn't help you of course, as you'd need to access all text IDs on the currently visible chart screen. This probably needs two steps, first store the barnumber for each bar
in a map (or array) using the datetime as map key and store each text ID within a map (or an array, but I'd suggest using a map and the ELCollections.DLL) and using the barnumber as the map key.

In a next step you'd have to get the datetime for the bar most left on the screen using aiLeftDispDateTime and the one on the right using aiRightDispDateTime. Use these two values to retrieve the barnumber
for the most left and most right bars and with these loop through the first map, retrieve each text ID and change the text location to the value of your choice.

Unfortunately I am not sure if there is something simpler, but the above should work. Although it might be too much work just for the aesthetics.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
  #4 (permalink)
 SPMC 
GER
 
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213

The easiest way is it to spilt the text into a realtime part and a history part:

 
Code
input: Upcolor(rgb(73, 120, 168)), downcolor(rgb(168, 73, 96)),
 NeutralColor(lightgray), TickDisplace( .0005 ), textsize(10), dataselect(3), screenpercent(5);
vars: Cvalue( 0 ),RTDELTA_Text(0),HistDelta_Text(0);
{
//data and calcs
if dataselect = 1 then
Cvalue = close of data1 - open of data1;

if dataselect = 2 then
Cvalue = close of data2 - open of data2;

if dataselect = 3 then
Cvalue = close of data3 - open of data3;}

//data and calcs
if dataselect = 1 then
Cvalue = close of data1 - Close[1] of data1;

if dataselect = 2 then
Cvalue = close of data2 - Close[1] of data2;

if dataselect = 3 then
Cvalue = close of data3 - Close[1] of data3;

Once 
begin
		RTDELTA_Text = text_new_S (DATE, Time_S, 0, "") ;
		text_SetStyle 		(RTDELTA_Text, 2, 1) ;
   		 
end;

if barstatus (dataselect ) = 2 then 
begin
	//Plot text
	HistDelta_Text = text_new_S(date,time_S,GetAppInfo( aiLowestDispValue ) + 0.01 * screenpercent*
		 ( GetAppInfo( aiHighestDispValue ) - GetAppInfo( aiLowestDispValue ) )  , numtostr(Cvalue,0));

	//stylize text
	text_setstyle(HistDelta_Text,2,1);	
	text_setsize(HistDelta_Text,textsize);

	if cvalue > 0 then
		text_setcolor(HistDelta_Text,upcolor)
	else if cvalue = 0 then
		text_setcolor(HistDelta_Text,NeutralColor)	
	else 
		text_setcolor(HistDelta_Text,downcolor);

	value1 = GetAppInfo( aiLowestDispValue ) ;
	value2 = GetAppInfo( aiHighestDispValue ) ;
end;

if LastBarOnChart_s then 
begin
	Text_SetString (RTDELTA_Text, numtostr(Cvalue,0));
	if cvalue > 0 then
		text_setcolor(RTDELTA_Text,upcolor)
	else if cvalue = 0 then
		text_setcolor(RTDELTA_Text,NeutralColor)	
	else
		text_setcolor(RTDELTA_Text,downcolor);
	text_SetStyle 		(RTDELTA_Text, 2, 1) ;
	Text_SetLocation_s 	(RTDELTA_Text,date, time_s, GetAppInfo( aiLowestDispValue ) + 0.01 * screenpercent*
		 ( GetAppInfo( aiHighestDispValue ) - GetAppInfo( aiLowestDispValue ) )  );
	text_setsize(RTDELTA_Text,textsize);

end;

if barstatus (dataselect ) = 2 and LastBarOnChart_s then 
begin
	if value1 <> value1 [1] or value2 <> value2 [1] then recalculate;
	
end;

Reply With Quote
The following user says Thank You to SPMC for this post:
  #5 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039

@SPMC

Thanks for the indi. however I am having problems with the switch from historical to real time. You can see here that there is a gap of values. They appear on the real time candle but then gap until the historical time series.


Started this thread Reply With Quote
  #6 (permalink)
 SPMC 
GER
 
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213

Could you post a complete chart with the data2/3 not hidden? Could it be that you have different settings in data1 and data2 (resolution, sessions, time zone)?

Reply With Quote
  #7 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039


SPMC View Post
Could you post a complete chart with the data2/3 not hidden? Could it be that you have different settings in data1 and data2 (resolution, sessions, time zone)?



i double checked all sessions are the same and time zones.

Started this thread Reply With Quote
  #8 (permalink)
 SPMC 
GER
 
Experience: Advanced
Platform: MC
Trading: ES
Posts: 144 since May 2011
Thanks Given: 11
Thanks Received: 213

As i have IQFeed and the code works, it seems that one problem is that at CQG the charts are not fully synchronized. Your upper chart shows a timestamp of 14:04:06.050 and both on the bottom a timestamp
of 14:05:21.093.
So barstatus (1) = 2 could be different to barstatus (3) = 2 .

Try to change the both lines with

if barstatus (dataselect ) = 2 then

to

if barstatus (1 ) = 2 then

Reply With Quote
The following user says Thank You to SPMC for this post:
  #9 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039


SPMC View Post
As i have IQFeed and the code works, it seems that one problem is that at CQG the charts are not fully synchronized. Your upper chart shows a timestamp of 14:04:06.050 and both on the bottom a timestamp
of 14:05:21.093.
So barstatus (1) = 2 could be different to barstatus (3) = 2 .

Try to change the both lines with

if barstatus (dataselect ) = 2 then

to

if barstatus (1 ) = 2 then

You're dead on, its because data 1 is M6E so there is a slight mismatch in time stamps.

Started this thread Reply With Quote
  #10 (permalink)
 Rockford 
West Branch, Mi, USA
 
Experience: Intermediate
Platform: Sierra Chart
Broker: TradePro/TransAct
Trading: NQ, CL
Posts: 59 since Nov 2012
Thanks Given: 10
Thanks Received: 11


Hi,
I'm saving this in Tradestation as an .ELD, and when I do I'm getting this error:

Unknown Identifier, Line 27.
RTDELTA_Text = text_new_S (DATE, Time_S, 0, "") ;

(Also, I added the change made by SPMC in his last post).

Should it be FOR VOLUME USE: "Trade Volume" or "Tick Count" ?

I'm not coder. If someone could help me out, I'd really appreciate it.

Thanks,
Rockford

Reply With Quote





Last Updated on January 21, 2020


© 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