NexusFi: Find Your Edge


Home Menu

 





EasyLanguage Chart Markup Indicator


Discussion in EasyLanguage Programming

Updated
    1. trending_up 6,573 views
    2. thumb_up 5 thanks given
    3. group 1 followers
    1. forum 8 posts
    2. attach_file 3 attachments




 
Search this Thread
  #1 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,672 since Jun 2009
Thanks Given: 33,404
Thanks Received: 102,210

Hey guys, I felt like there may be a need for a chart markup indicator for EasyLanguage.

So, here is what I came up with so far tonight. It will mark the Open, High, Low, Close, and the gap. It works best on a RTH chart (vs a Globex chart).

Each trendline color is configurable.

Let me know what you think, and feel free to make enhancements and share them back

[img]https://nexusfi.com/v/v57xvz.png[/img]

[img]https://nexusfi.com/v/ktgxee.png[/img]

[img]https://nexusfi.com/v/8pc4kj.png[/img]

One known problem is the lines/text are drawn per the GetAppInfo(aiLowestDispValue) meaning they will align themselves to the bottom of your chart just above the time axis. This works great in "real-time" if you load the indicator or reload it, but as you scroll back or forward, these past plots do not re-calculate or re-align themselves. I am not sure how to fix this, I am open to suggestions! It means that you may need to reload the indicator/refresh it to see the plots on historical data.

Another known limitation is it works only on 1 minute or 5 minute charts (well, I guess 30 minute could work too actually). This is due to the time recognition I coded for the open/close times. There has got to be a better way to do this, let me know!

Here is the EasyLanguage code:

 
Code
                            
// Big Mike Trading https://nexusfi.com

// 20 April 2010
// Indicator

// Specify open and close time in exact format per example, works only on 1 minute or 5 minute charts

input:
    
open_time ("8:30:00 AM"),
    
close_time ("1:30:00 PM"),
    
lineoffset 0.50 ),
    
textoffset 0.10 );

vars:
    
tlid_gap (0),
    
tlid2_gap (0),
    
txid_gap (0),
    
tlid_open (0),
    
txid_open (0),
    
tlid_close (0),
    
txid_close (0),
    
lastclose (0),
    
lastcloset (0),
    
lastclosed (0),
    
dhigh (0),
    
dlow (0),
    
tlid_high (0),
    
tlid_low (0),
    
tlid_high_d (0),
    
tlid_high_t (0),
    
tlid_low_d (0),
    
tlid_low_t (0),
    
txid_high (0),
    
txid_low (0);

once Plot1(0"Open");
once Plot2(0"Close");
once Plot3(0"Gap Up");
once Plot4(0"Gap Down");
once Plot5(0"High");
once Plot6(0"Low");

if 
date <> date[1then begin

    dhigh 
H;
    
dlow L;
    
tlid_high_d D;
    
tlid_high_t T;
    
tlid_low_d D;
    
tlid_low_t T;
    
    
tlid_high TL_New(datetimeHdatetimeH);
    
tlid_low TL_New(datetimeLdatetimeL);
    
    
txid_high Text_New(datetimedhightext("H: "dhigh));
    
txid_low Text_New(datetimedlowtext("L: "dlow));

end;

if 
dhigh then begin dhigh Htlid_high_d Dtlid_high_t Tend;

if 
dhigh then begin

    TL_SetBegin
(tlid_hightlid_high_dtlid_high_tdhigh);
    
TL_SetEnd(tlid_highdatetimedhigh);
    
TL_SetColor(tlid_highGetPlotColor(5));

    
Text_SetLocation(txid_highdatetimedhigh);
    
Text_SetStyle(txid_high11);
    
Text_SetString(txid_hightext("H: "dhigh" "));
    
Text_SetColor(txid_highGetPlotColor(5));
    
    
end;

if 
dlow then begin dlow Ltlid_low_d Dtlid_low_t Tend;

if 
dlow then begin

    TL_SetBegin
(tlid_lowtlid_low_dtlid_low_tdlow);
    
TL_SetEnd(tlid_lowdatetimedlow);
    
TL_SetColor(tlid_lowGetPlotColor(6));
    
    
    
Text_SetLocation(txid_lowdatetimedlow);
    
Text_SetStyle(txid_low10);
    
Text_SetString(txid_lowtext("L: "dlow" "));
    
Text_SetColor(txid_lowGetPlotColor(6));

end;


if 
TimeToString(ELTimeToDateTime(time)) = open_time then begin

    tlid_gap 
TL_New(datetimelastclosedatetimeiff(lastcloselineoffsetlineoffset));
    
tlid2_gap TL_New(lastclosedlastclosetlastclosedatetimelastclose);

    if 
lastclose then txid_gap Text_New(datetimelastclose textoffsettext("Gap +", ((O-lastclose) / MinMove*PriceScale):0:0));
    if 
lastclose then txid_gap Text_New(datetimelastclose textoffsettext("Gap -", ((lastclose-O) / MinMove*PriceScale):0:0));
    
    
Text_SetStyle(txid_gap12);
    
    
TL_SetColor(tlid_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));
    
TL_SetColor(tlid2_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));
    
Text_SetColor(txid_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));

    
tlid_open TL_New(datetimeGetAppInfo(aiLowestDispValue) + (textoffset*2), datetimeMinList(lastclose-lineoffsetO-lineoffset));
    
txid_open Text_New(datetimeGetAppInfo(aiLowestDispValue) + textoffsettext("O: "O));
    
    
TL_SetColor(tlid_openGetPlotColor(1));
    
Text_SetColor(txid_openGetPlotColor(1));
    
Text_SetStyle(txid_open02);
    
end;

if 
TimeToString(ELTimeToDateTime(time)) = close_time then begin

    tlid_close 
TL_New(datetimeGetAppInfo(aiLowestDispValue) + (textoffset*2), datetimeC-lineoffset);
    
txid_close Text_New(datetimeGetAppInfo(aiLowestDispValue) + textoffsettext("C: "C" "));

    
TL_SetColor(tlid_closeGetPlotColor(2));
    
Text_SetColor(txid_closeGetPlotColor(2));
    
Text_SetStyle(txid_close12);
    
    
lastclose C;
    
lastclosed D;
    
lastcloset T;
end
I've also attached the MultiCharts .pla.

Mike



Join the free Markets Chat beta: Real-time Trading Insights

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Attached Files
Elite Membership required to download: BMT-Chart Markup.pla
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
IB Gateway / IBKR (semi-) daily restart / login
Platforms and Indicators
Cycle Through Ninjatrader Open Windows
NinjaTrader
Equity Monaco download file?
Psychology and Money Management
Server CPUs and Multicharts 14 or 15 limits
MultiCharts
IBD Accumulation/Distribution Rating
NinjaTrader
 
  #3 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69


Mike - thank you so much for putting this indicator together, I'm having a problem with the Gap when using on the ES .... it doesn't show the correct number and I'm not familiar with your contruction:

if O > lastclose then txid_gap = Text_New(date, time, lastclose - textoffset, text("Gap +", ((O-lastclose) / MinMove*PriceScale):0:0));
if O < lastclose then txid_gap = Text_New(date, time, lastclose + textoffset, text("Gap -", ((lastclose-O) / MinMove*PriceScale):0:0));

Can you please point me in the right direction? Thanks in advance.

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,672 since Jun 2009
Thanks Given: 33,404
Thanks Received: 102,210


sharp2be View Post
Mike - thank you so much for putting this indicator together, I'm having a problem with the Gap when using on the ES .... it doesn't show the correct number and I'm not familiar with your contruction:

if O > lastclose then txid_gap = Text_New(date, time, lastclose - textoffset, text("Gap +", ((O-lastclose) / MinMove*PriceScale):0:0));
if O < lastclose then txid_gap = Text_New(date, time, lastclose + textoffset, text("Gap -", ((lastclose-O) / MinMove*PriceScale):0:0));

Can you please point me in the right direction? Thanks in advance.

Are you using a RTH chart or a 24h chart? I think the error might be in the Open price, which is used for the gap.

On the menu, did you enter the open and close time precisely in the format of "H:MM:SS AM" ? So for 9:30am on ES you need 9:30:00 AM. You might try changing it to 9:35:00 AM and see if that does it, since your first candle might be the Open candle, otherwise it would need code changes.

Mike



Join the free Markets Chat beta: Real-time Trading Insights

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69

Mike - please see attached ... it shows the Close, Open and also the Gap but the gap amount is incorrect (should not be 24).. looking at the code it seems the calculation is correct, just the display is incorrect..

Attached Thumbnails
Click image for larger version

Name:	BMT-OHLC.png
Views:	311
Size:	23.7 KB
ID:	11965  
Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,672 since Jun 2009
Thanks Given: 33,404
Thanks Received: 102,210


sharp2be View Post
Mike - please see attached ... it shows the Close, Open and also the Gap but the gap amount is incorrect (should not be 24).. looking at the code it seems the calculation is correct, just the display is incorrect..

Gotcha, I see. It has to do with the Tick Size (MinMove/PriceScale) most likely. I only tested it on CL, and ES is different.

I'll take a look at it as soon as I can.

Mike



Join the free Markets Chat beta: Real-time Trading Insights

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
sharp2be's Avatar
 sharp2be 
Canada
 
Experience: Advanced
Platform: NT, TS
Broker: Amp
Trading: ES
Posts: 57 since Sep 2009
Thanks Given: 1
Thanks Received: 69

Thanks Mike

Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,672 since Jun 2009
Thanks Given: 33,404
Thanks Received: 102,210

I tested this on my side today for the ES, it seemed to work fine (no code changes).

I am central time.

I set the "open" to "8:35:00 AM", because the time stamp of the bar is the closing time of the bar in MultiCharts. I set the "close" to "1:30:00 PM".

I believe it worked correctly. The gap is listed as +3, as in 3 ticks. The open is @ 1213.50 and the close 1207.50. The high is 1216.50 and low 1207.50. The close-to-close was -21 ticks from yesterday.

Shown here:

[img]https://nexusfi.com/v/b8j9g9.png[/img]

I had incorrectly been using 8:30:00 AM it should be 8:35:00 AM, please take note (For ES, central time). For CL it would be 8:05:00 AM (central time).

Mike



Join the free Markets Chat beta: Real-time Trading Insights

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #9 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,672 since Jun 2009
Thanks Given: 33,404
Thanks Received: 102,210

Hi guys,

A new version is here, this should now work on any chart (not just 1 or 5 minute), and it also fixes a couple small problems.

 
Code
                            
// Big Mike Trading https://nexusfi.com
// 20 April 2010
// Indicator

// Specify open and close time in exact format per example H:MM:SS AM/PM

input:
    
open_time ("8:05:00 AM"),
    
close_time ("1:30:00 PM"),
    
lineoffset 0.50 ),
    
textoffset 0.10 );

vars:
    
tlid_gap (0),
    
tlid2_gap (0),
    
txid_gap (0),
    
tlid_open (0),
    
txid_open (0),
    
tlid_close (0),
    
txid_close (0),
    
lastclose (0),
    
lastcloset (0),
    
lastclosed (0),
    
dhigh (0),
    
dlow (0),
    
tlid_high (0),
    
tlid_low (0),
    
tlid_high_d (0),
    
tlid_high_t (0),
    
tlid_low_d (0),
    
tlid_low_t (0),
    
txid_high (0),
    
txid_low (0),
    
openset (false),
    
closeset (false),
    
close_prefix ("+");

once Plot1(0"Open");
once Plot2(0"Close");
once Plot3(0"Gap Up");
once Plot4(0"Gap Down");
once Plot5(0"High");
once Plot6(0"Low");

if 
date <> date[1then begin

    openset 
false;
    
closeset false;
    
dhigh H;
    
dlow L;
    
tlid_high_d D;
    
tlid_high_t T;
    
tlid_low_d D;
    
tlid_low_t T;
    
    
tlid_high TL_New(datetimeHdatetimeH);
    
tlid_low TL_New(datetimeLdatetimeL);
    
    
txid_high Text_New(datetimedhightext("H: "dhigh));
    
txid_low Text_New(datetimedlowtext("L: "dlow));

end;

if 
dhigh then begin dhigh Htlid_high_d Dtlid_high_t Tend;

if 
<= dhigh then begin

    TL_SetBegin
(tlid_hightlid_high_dtlid_high_tdhigh);
    
TL_SetEnd(tlid_highdatetimedhigh);
    
TL_SetColor(tlid_highGetPlotColor(5));

    
Text_SetLocation(txid_highdatetimedhigh);
    
Text_SetStyle(txid_high11);
    
Text_SetString(txid_hightext("H: "dhigh" "));
    
Text_SetColor(txid_highGetPlotColor(5));
    
    
end;

if 
dlow then begin dlow Ltlid_low_d Dtlid_low_t Tend;

if 
>= dlow then begin

    TL_SetBegin
(tlid_lowtlid_low_dtlid_low_tdlow);
    
TL_SetEnd(tlid_lowdatetimedlow);
    
TL_SetColor(tlid_lowGetPlotColor(6));
    
    
    
Text_SetLocation(txid_lowdatetimedlow);
    
Text_SetStyle(txid_low10);
    
Text_SetString(txid_lowtext("L: "dlow" "));
    
Text_SetColor(txid_lowGetPlotColor(6));

end;


//if TimeToString(ELTimeToDateTime(time)) = open_time then begin
if time >= StringToTime(open_time) and openset false then begin

    openset 
true;
    
tlid_gap TL_New(datetimelastclosedatetimeiff(lastcloselineoffsetlineoffset));
    
tlid2_gap TL_New(lastclosedlastclosetlastclosedatetimelastclose);

    if 
lastclose then txid_gap Text_New(datetimelastclose textoffsettext("Gap +", ((O-lastclose) / MinMove*PriceScale):0:0));
    if 
lastclose then txid_gap Text_New(datetimelastclose textoffsettext("Gap -", ((lastclose-O) / MinMove*PriceScale):0:0));
    
    
Text_SetStyle(txid_gap12);
    
    
TL_SetColor(tlid_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));
    
TL_SetColor(tlid2_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));
    
Text_SetColor(txid_gapiff(lastcloseGetPlotColor(3), GetPlotColor(4)));

    
tlid_open TL_New(datetimeGetAppInfo(aiLowestDispValue) + (textoffset*2), datetimeMinList(lastclose-lineoffsetO-lineoffset));
    
txid_open Text_New(datetimeGetAppInfo(aiLowestDispValue) + textoffsettext("O: "O));
    
    
TL_SetColor(tlid_openGetPlotColor(1));
    
Text_SetColor(txid_openGetPlotColor(1));
    
Text_SetStyle(txid_open02);

end;

//if TimeToString(ELTimeToDateTime(time)) = close_time then begin
if (time >= StringToTime(close_time) and closeset false) or Sess1EndTime time then begin

    closeset 
true;
    
tlid_close TL_New(datetimeGetAppInfo(aiLowestDispValue) + (textoffset*2), datetimeC-lineoffset);
    if 
C-lastclose 0 then close_prefix "+" else close_prefix "";
    
txid_close Text_New(datetimeGetAppInfo(aiLowestDispValue) + textoffsettext("C: "C" ("close_prefix, ((C-lastclose) / MinMove PriceScale):0:0" ticks) "));

    
TL_SetColor(tlid_closeGetPlotColor(2));
    
Text_SetColor(txid_closeGetPlotColor(2));
    
Text_SetStyle(txid_close12);
    
    
lastclose C;
    
lastclosed D;
    
lastcloset T;
end
MultiCharts .pla attached.

Mike



Join the free Markets Chat beta: Real-time Trading Insights

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Attached Files
Elite Membership required to download: BMT ChartMarkup.pla
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on April 29, 2010


© 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 - Sitemap - Downloads - Top
no new posts