Help To Modify Range Indicator - ObjectCreate / Rectangle

Post Reply
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by theforexedge »

Hi.

I've been trying to modify this ranging indicator to add a rectangle on the chart when the market starts to range instead of the current histogram.

I've had a good look at the mql4 documentation on-line and several other indicators but I'm a bit stumped with how to start the first anchor point with the high & low of the bars and then the end point... ;)

I would appreciate any advice, direction to some on-line resource or ideally if someone could do the mod as my coding is quite limited, but slowly improving with the help of Steve et al :-)

I find the indicator really useful for identifying accumulation / distribution, so worth anyone giving it a try as i have been using it on my live account for the past few months!

Thanks, Jason
You do not have the required permissions to view the files attached to this post.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by renexxxx »

I've made some changes to the indicator, so that it draws some rectangles.

Rene.
You do not have the required permissions to view the files attached to this post.
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.

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by SteveHopwood »

renexxxx » Sat Nov 11, 2017 10:25 pm wrote:I've made some changes to the indicator, so that it draws some rectangles.

Rene.
Thanks for stepping in Rene. You again offer help to a SHF member that the likes of me are incapable of offering. We are all deeply grateful for your help. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
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.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by theforexedge »

renexxxx » Sat Nov 11, 2017 10:25 pm wrote:I've made some changes to the indicator, so that it draws some rectangles.

Rene.
Rene

Thank you very much for taking the time to do this...it's really useful for me as I try to learn by looking at the code to figure out what's actually going on, especially drawing anything on the chart is still quite a mystery for me! i know why Steve keeps away from indicators!

One other indicator that was coded by f451 (a SHF member) a few years back and i've been using is his VSA-Signals indicator. The indicator is working fine now, but one thing I've been trying to figure out is how to check the signals when the next bar closes up / down respectively, and then confirm the signal on the chart with a change of colour. I was thinking this might be able to be done with ObjectGetValueByShift( ); and waiting for the next bar, but how to do this is quite beyond me!

I have been using the indicator and shifting the bar back +1 but it would be nice to see both the unconfirmed & confirmed signals on the chart...then next is to make a dashboard! :smile:

Anyway its a really great indicator that other SHF members might find useful as is or modified :clap:

Code: Select all

int DisplaySignal(int s, int bar)
{
   if (s==EMPTY_VALUE)
   { return(0);}
   
   icolor = wrong_background;  // if wrong background, show signal in gray
   if (s < 9) 
   { 
     dprice = High[bar] + 0.1*CalcRange(bar, false);
     if (background == weakness) // background weakness, signal weakness, mark with red
     { icolor = weakness_color; }
   } 
   else 
   { 
     dprice = Low[bar] - 0.1*CalcRange(bar, false); 
     if (background == strength)  // background strength, signal strength, mark with blue
     { icolor = strength_color; }
   }
   if (ObjectCreate(objprefix+" "+text[s]+" ("+bar+")", OBJ_ARROW, 0, Time[bar], dprice) == true)
   {
      ObjectSet(objprefix+" "+text[s]+" ("+bar+")", OBJPROP_ARROWCODE, code[s]);     
      ObjectSet(objprefix+" "+text[s]+" ("+bar+")", OBJPROP_COLOR, icolor);
      SetIndexArrow(3,code[s]);
      sctr++; 
   }
   last_dprice = dprice; // might use last signal position to clear and rewrite signals for those that need confirmation
   return(0);
}
You do not have the required permissions to view the files attached to this post.
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by tomele »

Pandora's box has opened.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by theforexedge »

tomele » Sun Nov 12, 2017 10:57 pm wrote:Pandora's box has opened.
:lol:
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by renexxxx »

theforexedge » Mon Nov 13, 2017 4:44 am wrote: One other indicator that was coded by f451 (a SHF member) a few years back and i've been using is his VSA-Signals indicator. The indicator is working fine now, but one thing I've been trying to figure out is how to check the signals when the next bar closes up / down respectively, and then confirm the signal on the chart with a change of colour. I was thinking this might be able to be done with ObjectGetValueByShift( ); and waiting for the next bar, but how to do this is quite beyond me!
Not sure what you mean with "confirm the signal". The signals are only calculated for candles 1 and higher (i.e. closed candles). The calculation of the signal for any candle n only needs price data for candle n and candle n+1. So, once a signal is calculated for a closed candle, it will never change -- it is set in stone. Therefore, the notion of "confirming the signal" is not clear.
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help To Modify Range Indicator - ObjectCreate / Rectangle

Post by theforexedge »

Rene

Ah! sorry i really meant to reconfirm the signal that was on the previous bar. When trading with VSA (volume) the signals are much more powerful when the next bar closes up / down than the previous bar [bar+1]. Most people make the mistake by just trading the confirmed signal :)

I've attached a screen shot of what i hope we can achieve..

This is currently done with a Pinbar indicator and a mod of the indicator(two indicators are running on the same chart) that looks at candle n+1 and candle n+2 and confirms with the close of candle n and candle n+1 then prints the star symbol over the dot.

Let me know if you need any further clarification and apologies for my lack of terminology with the candles and confirmation :oops:

Jason
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Indicators”