NexusFi: Find Your Edge


Home Menu

 





Indicator to Plot the OHLC - user selected start/stop times


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Fat Tails with 48 posts (61 thanks)
    2. looks_two rfiske with 17 posts (0 thanks)
    3. looks_3 gtichauer with 16 posts (2 thanks)
    4. looks_4 TempletonPeck with 4 posts (0 thanks)
      Best Posters
    1. looks_one Fat Tails with 1.3 thanks per post
    2. looks_two soulartist with 1 thanks per post
    3. looks_3 runner with 0.3 thanks per post
    4. looks_4 gtichauer with 0.1 thanks per post
    1. trending_up 44,605 views
    2. thumb_up 68 thanks given
    3. group 13 followers
    1. forum 105 posts
    2. attach_file 29 attachments




 
Search this Thread

Indicator to Plot the OHLC - user selected start/stop times

  #71 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


gtichauer View Post
FT,

Now working perfect on historical data....will check Monday on Real time. or weekend on replay....two comments:
- do I have to change anything as I did with prev version to plot OR high/low since they are defined (remaining fixed) instead of since the opening and moving until they are finally defined?

- with prev version I edited and changed the names to IB High/Low and o/n High/low but in this case it is not working? can u guide me how to do this?

thanks again !!!

Define session template with multi-sessions. Then select the session (first, second or third) to which you want to apply the opening range. Select opening range duration.

You will need to rename the following lines:

for OR-High, OR-Low and OR-mid lines 114-116

 
Code
 
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-High"));
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-Low"));
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-Mid"));

for Pre-High and Pre-Low lines 117-118
 
Code
 
Add(new Plot(new Pen(Color.White,1), PlotStyle.Line,"Pre-High"));
Add(new Plot(new Pen(Color.White,1), PlotStyle.Line,"Pre-Low"));
and line 781
 
Code
 
if (european && !ignoreEuropean && ( plot.Name == "Pre-High" || plot.Name == "Pre-Low"))
and also lines 820-827 (see below)


for AS-High, AS-Low, EU-High and EU-Low lines 820-827
 
Code
 
if (asian && !ignoreAsian && plot.Name == "Pre-High")
plotString = "AS-High";
else if (asian && !ignoreAsian && plot.Name == "Pre-Low")
plotString = "AS-Low";
else if (european && !ignoreEuropean && plot.Name == "Pre-High")
plotString = "EU-High";
else if (european && !ignoreEuropean && plot.Name == "Pre-Low")
plotString = "EU-Low";

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
REcommedations for programming help
Sierra Chart
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #72 (permalink)
 
gtichauer's Avatar
 gtichauer 
Argentina
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire / IB
Trading: ES, TF, 6E, CL
Posts: 379 since Jul 2009
Thanks Given: 807
Thanks Received: 298


Fat Tails View Post
Define session template with multi-sessions. Then select the session (first, second or third) to which you want to apply the opening range. Select opening range duration.

You will need to rename the following lines:

for OR-High, OR-Low and OR-mid lines 114-116

 
Code
 
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-High"));
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-Low"));
Add(new Plot(new Pen(Color.Goldenrod,1), PlotStyle.Line,"OR-Mid"));

for Pre-High and Pre-Low lines 117-118
 
Code
 
Add(new Plot(new Pen(Color.White,1), PlotStyle.Line,"Pre-High"));
Add(new Plot(new Pen(Color.White,1), PlotStyle.Line,"Pre-Low"));
and line 781
 
Code
 
if (european && !ignoreEuropean && ( plot.Name == "Pre-High" || plot.Name == "Pre-Low"))
and also lines 820-827 (see below)


for AS-High, AS-Low, EU-High and EU-Low lines 820-827
 
Code
 
if (asian && !ignoreAsian && plot.Name == "Pre-High")
plotString = "AS-High";
else if (asian && !ignoreAsian && plot.Name == "Pre-Low")
plotString = "AS-Low";
else if (european && !ignoreEuropean && plot.Name == "Pre-High")
plotString = "EU-High";
else if (european && !ignoreEuropean && plot.Name == "Pre-Low")
plotString = "EU-Low";

FT,

I am sorry to say that I changed every line of code u mention and don't know why or how but it keeps showing the original labels.....I deleted the file, reinstalled it and same issue.......one comment to mention.....the first time I installed it I changed colors and press right button and SET DEFAULT for those parameters......AFTER THAT I deleted and reinstalled and the parameters by default were the LAST ONES I modified, NOT the ones from your original version (which I would expect IF I deleted and reinstalled)......any idea what may be happening that I can not change the plots?

also run on replay and as previous versions it start plotting since the opening.....u told me before to modify one line to change this .....see below
- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -
(1) Modify line 324 of the indicator to

 
Code
 
if (plotOHL && sessionOpen && Time[0] > sessionEnd.Subtract(sessionLength-openingPeriod))
and it will only start plotting the opening range after the opening period is complete. The opening range will be shown starting from the open.
- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -

But this has changed now.....I should be changing some other line I believe....can u guide me pls?

GT
Follow me on Twitter Reply With Quote
  #73 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



gtichauer View Post
FT,

I am sorry to say that I changed every line of code u mention and don't know why or how but it keeps showing the original labels.....I deleted the file, reinstalled it and same issue.......one comment to mention.....the first time I installed it I changed colors and press right button and SET DEFAULT for those parameters......AFTER THAT I deleted and reinstalled and the parameters by default were the LAST ONES I modified, NOT the ones from your original version (which I would expect IF I deleted and reinstalled)......any idea what may be happening that I can not change the plots?

also run on replay and as previous versions it start plotting since the opening.....u told me before to modify one line to change this .....see below
- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -
(1) Modify line 324 of the indicator to

 
Code
 
if (plotOHL && sessionOpen && Time[0] > sessionEnd.Subtract(sessionLength-openingPeriod))
and it will only start plotting the opening range after the opening period is complete. The opening range will be shown starting from the open.
- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - -

But this has changed now.....I should be changing some other line I believe....can u guide me pls?

(1) To change the label lines: Edit indicator via Tools -> Edit Ninjajscript -> Indicator. Then change the code. Press F5 to compile and you are done.

(2) Change line 404 to

 
Code
 
if (plotOHL && initOpeningRange && Time[0] >= sessionStartTime.Add(openingPeriod))
The indicator will now start plotting the opening range, when complete but plot the line back to where it started.

Reply With Quote
Thanked by:
  #74 (permalink)
 
gtichauer's Avatar
 gtichauer 
Argentina
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire / IB
Trading: ES, TF, 6E, CL
Posts: 379 since Jul 2009
Thanks Given: 807
Thanks Received: 298


Fat Tails View Post
(1) To change the label lines: Edit indicator via Tools -> Edit Ninjajscript -> Indicator. Then change the code. Press F5 to compile and you are done.

(2) Change line 404 to

 
Code
 
if (plotOHL && initOpeningRange && Time[0] >= sessionStartTime.Add(openingPeriod))
The indicator will now start plotting the opening range, when complete but plot the line back to where it started.

(1) that is exactly what I did.....moreover I did it with success in the prev versions.....
(2) will do this later...now from cell phone....thanks !!

GT
Follow me on Twitter Reply With Quote
  #75 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

If you are lazy, you can just edit the indicator and use the Find/Replace option. That will do in any case, and you do not need to search the file. Just put in your preferred label, select Match case and then Replace All.

See below.

Attached Thumbnails
Click image for larger version

Name:	Lazy.JPG
Views:	146
Size:	20.3 KB
ID:	20068  
Reply With Quote
Thanked by:
  #76 (permalink)
 
gtichauer's Avatar
 gtichauer 
Argentina
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire / IB
Trading: ES, TF, 6E, CL
Posts: 379 since Jul 2009
Thanks Given: 807
Thanks Received: 298


Fat Tails View Post
If you are lazy, you can just edit the indicator and use the Find/Replace option. That will do in any case, and you do not need to search the file. Just put in your preferred label, select Match case and then Replace All.

See below.

Will try this tomorrow.....thanks !!!

GT
Follow me on Twitter Reply With Quote
  #77 (permalink)
 
gtichauer's Avatar
 gtichauer 
Argentina
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire / IB
Trading: ES, TF, 6E, CL
Posts: 379 since Jul 2009
Thanks Given: 807
Thanks Received: 298


Fat Tails View Post
(1) To change the label lines: Edit indicator via Tools -> Edit Ninjajscript -> Indicator. Then change the code. Press F5 to compile and you are done.

(2) Change line 404 to

 
Code
 
if (plotOHL && initOpeningRange && Time[0] >= sessionStartTime.Add(openingPeriod))
The indicator will now start plotting the opening range, when complete but plot the line back to where it started.

(2) worked great......still fighting with (1).....not being able to change the labels on this one....tried the Find and Replace also....quite strange....will check it tomorrow again and share.....thanks !!!

GT
Follow me on Twitter Reply With Quote
  #78 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


gtichauer View Post
......still fighting with (1).....

Then go and fight again....

Reply With Quote
Thanked by:
  #79 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

While the indicator from post #64 looks correct, the indicator Test2OpeningRangeV28 from post #68, which I had modified for older versions of NT7 has a small bug. I have replaced it with Test3OpeningRangeV28, which should run correctly.

Details: It was a typical copy-and-paste bug. If you have already installed the indicator, just replace line 765

 
Code
 
Bars.Session.GetNextBeginEnd(Time[0], out thisSessionBegin, out thisSessionEnd);
with

 
Code
 
Bars.Session.GetNextBeginEnd(barTime, out thisSessionBegin, out thisSessionEnd);
Due to the bug, the opening range lines can be drawn back into the prior session.

Reply With Quote
  #80 (permalink)
 
gtichauer's Avatar
 gtichauer 
Argentina
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire / IB
Trading: ES, TF, 6E, CL
Posts: 379 since Jul 2009
Thanks Given: 807
Thanks Received: 298



Fat Tails View Post
Then go and fight again....

FT,

is there something u think I may have in memory that I should manually delete that could be causing renamed labels not to be reflected?

As I told u, I change the colors of the lines, press right mouse button and save as default, but even if I delete the indi, imported again, IT DOES NOT SHOW ORIGINAL COLORS, it remains with the ones I changed......(żif I delete the indi and reinstall shouldn't it be as the original?)......this is what lead me to believe something is happening on the back....I reintstall four times and no way to change the labels....I also tested the first V28 version for b21 only and the same....
any thoughts?

ZTR told me there was some way of using the output window to check if the code was doing what it was meant to do and do some kind of test.....he went to hospital so we could not skype to check this....any idea what was this?

Thanks,

GT
Follow me on Twitter Reply With Quote




Last Updated on October 14, 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