Indicator Request

MPTM's new home
Post Reply
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Indicator Request

Post by SteveHopwood »

Hehe. Opps. I was doing gormless to international standards last night. You need someone to captain your National Gormless side, then look no further. <Ignores cries of, "Yes, we know.">

The solution could not be simpler. We were both confusing the bars highest price with its opening time. :arrrg: We need a price for a horizontal line but a bar shift for a vertical line.

Interested bystanders, the kind of logic knicker-in-a-twist state that Angat and I got ourselves into is the state that most beginner coders find themselves in all the time. Nice when we solve the problem though.

Solution attached.

:xm:
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

SteveHopwood » Wed Dec 31, 2014 5:05 pm wrote:Hehe. Opps. I was doing gormless to international standards last night. You need someone to captain your National Gormless side, then look no further. <Ignores cries of, "Yes, we know.">

The solution could not be simpler. We were both confusing the bars highest price with its opening time. :arrrg: We need a price for a horizontal line but a bar shift for a vertical line.

Interested bystanders, the kind of logic knicker-in-a-twist state that Angat and I got ourselves into is the state that most beginner coders find themselves in all the time. Nice when we solve the problem though.

Solution attached.

:xm:
Thank you, that's the first part pretty much done. Pretty much exactly what I wanted for the primary vertical bar. The only thing I can see is an auto-accuracy feature where it auto adjusts to the nearest minute of the high regardless of what timeframe is entered by the user. So if the user goes down in Empty4 to a lower timeframe it adjusts.

It can currently do this if I set extern TimeFrame to 1M and set lookbackbars to like 250,000, but seems like a very inefficient way. Anyway don't worry if its more complicated than its worth.

Cheers for the sorting out my first part.

Will go for dinner and look into part 2. Thanks again both of you. HNY! :!!:
.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Indicator Request

Post by milanese »

Angat » Wed Dec 31, 2014 5:37 pm wrote:
Thank you, that's the first part pretty much done. Pretty much exactly what I wanted for the primary vertical bar. The only thing I can see is an auto-accuracy feature where it auto adjusts to the nearest minute of the high regardless of what timeframe is entered by the user. So if the user goes down in Empty4 to a lower timeframe it adjusts.

It can currently do this if I set extern TimeFrame to 1M and set lookbackbars to like 250,000, but seems like a very inefficient way. Anyway don't worry if its more complicated than its worth.

Cheers for the sorting out my first part.

Will go for dinner and look into part 2. Thanks again both of you. HNY! :!!:
:uff: I must admit I was yesterday not at my high :arrrg: :arrrg: , I did not understood that you wanted a vertical line... sorry for that(I had horizontal in my mind and even if your wrote it correct it was overwritten from my fixed idea of an horizontalline), I am happy to see that Steve has found a solution!

Cheers and have a great new year!!! :xm:

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Angats_VLines_1.01.mq4
This is where I'm at currently. I tried to copy Tommaso function + i+10 code to my script, but I just don't know enough to get anywhere yet. I'll try again later, but in case you're bored feel free to give it a whack.

So I need a repeatable vertical line "AlphaLine" that counts X e.g. 10 from the primary line and prints a vertical line then counts 10 bars more and prints another vertical line and so on.
You do not have the required permissions to view the files attached to this post.
.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Code: Select all

   int highest_bar = iHighest(NULL,TimeFrame,MODE_HIGH,LookBack,0);
      DrawVerticalLine("HH_Line", iTime(Symbol(), TimeFrame, highest_bar), PrimaryLineColor, STYLE_SOLID, PrimaryLineWidth);
      
      
       for(int i=highest_bar; i>=0; i-=DrawAlphaLineEveryXBars)
        {
      DrawVerticalLine("AlphaLine", iTime(Symbol(), TimeFrame, i), AlphaLineColor, STYLE_SOLID, AlphaLineWidth);
  
        }

This is what I have so far to try and get the repeating part to function. Feels like im getting closer but not there yet..
.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Indicator Request

Post by milanese »

Angat » Thu Jan 01, 2015 2:43 pm wrote:

Code: Select all

   int highest_bar = iHighest(NULL,TimeFrame,MODE_HIGH,LookBack,0);
      DrawVerticalLine("HH_Line", iTime(Symbol(), TimeFrame, highest_bar), PrimaryLineColor, STYLE_SOLID, PrimaryLineWidth);
      
      
       for(int i=highest_bar; i>=0; i-=DrawAlphaLineEveryXBars)
        {
      DrawVerticalLine("AlphaLine", iTime(Symbol(), TimeFrame, i), AlphaLineColor, STYLE_SOLID, AlphaLineWidth);
  
        }

This is what I have so far to try and get the repeating part to function. Feels like im getting closer but not there yet..
try if the attached one does what you want..
angatsVLines.mq4
Cheers :)

Tommaso
You do not have the required permissions to view the files attached to this post.
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

milanese » Thu Jan 01, 2015 4:33 pm wrote:
Angat » Thu Jan 01, 2015 2:43 pm wrote:

Code: Select all

   int highest_bar = iHighest(NULL,TimeFrame,MODE_HIGH,LookBack,0);
      DrawVerticalLine("HH_Line", iTime(Symbol(), TimeFrame, highest_bar), PrimaryLineColor, STYLE_SOLID, PrimaryLineWidth);
      
      
       for(int i=highest_bar; i>=0; i-=DrawAlphaLineEveryXBars)
        {
      DrawVerticalLine("AlphaLine", iTime(Symbol(), TimeFrame, i), AlphaLineColor, STYLE_SOLID, AlphaLineWidth);
  
        }

This is what I have so far to try and get the repeating part to function. Feels like im getting closer but not there yet..
try if the attached one does what you want..

Cheers :)

Tommaso
Ah wow, I think that is it. I'll test it properly in a bit and try and learn from what you did too.

Thanks for this. Was a great new years day present !

<3
.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

How difficult would it be to embed the Heikin Ashi indicator into Angats_VLines and have it activated with an extern bool?

I tried it using an if statement around a copy n paste of the whole indicator and it said something like cant use an If statement on a global scope. Damn! xD

I take it if its possible it has to be properly embedded.

I guess I can try it but do bool if statements work in the init and oncalculate methods?

And is it also possible to hardcode a tpl into the indicator?

Cheers
.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Indicator Request

Post by milanese »

Angat » Fri Jan 02, 2015 10:33 am wrote:How difficult would it be to embed the Heikin Ashi indicator into Angats_VLines and have it activated with an extern bool?

I tried it using an if statement around a copy n paste of the whole indicator and it said something like cant use an If statement on a global scope. Damn! xD

I take it if its possible it has to be properly embedded.

I guess I can try it but do bool if statements work in the init and oncalculate methods?

And is it also possible to hardcode a tpl into the indicator?

Cheers
it could be embedded sure, but you must explain, what you exactly want to do the HeikenAshi, with copy paste it will not work, the easiest way for you would be using an iCustom call, how to do that, you can read there --->
http://docs.mql4.com/indicators/icustom
Basicly something like ...

Code: Select all

haOpen = iCustom(NULL,0,"HeikenAshi",Red,White,Red,White,2,1);
haClose = iCustom(NULL,0,"HeikenAshi",Red,White,Red,White,3,1);
Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

milanese » Fri Jan 02, 2015 10:48 am wrote:
Angat » Fri Jan 02, 2015 10:33 am wrote:How difficult would it be to embed the Heikin Ashi indicator into Angats_VLines and have it activated with an extern bool?

I tried it using an if statement around a copy n paste of the whole indicator and it said something like cant use an If statement on a global scope. Damn! xD

I take it if its possible it has to be properly embedded.

I guess I can try it but do bool if statements work in the init and oncalculate methods?

And is it also possible to hardcode a tpl into the indicator?

Cheers
it could be mebedded sure, but you must explain, what you exactly want to do the HeikenAshi, with copy paste it will not work, the easiest way for you would be using an iCustom call, how to do that you can read there --->
http://docs.mql4.com/indicators/icustom
Basicly something like ...

Code: Select all

haOpen = iCustom(NULL,0,"HeikenAshi",Red,White,Red,White,2,1);
haClose = iCustom(NULL,0,"HeikenAshi",Red,White,Red,White,3,1);
Cheers :)

Tommaso
Interesting, thank you, I'll give that a shot.
.
Post Reply

Return to “Utilities Indicators and Scripts”