Indicator Request

MPTM's new home
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Code: Select all

  double haLowBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,0);
  double haHighBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,0);
  double haOpenBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,0);
  double haCloseBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,0);
 
  double haLowBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,1);
  double haHighBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,1);
  double haOpenBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,1);
  double haCloseBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,1);
 
  double haLowBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,2);
  double haHighBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,2);
  double haOpenBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,2);
  double haCloseBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,2);
 
  double haLowBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,3);
  double haHighBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,3);
  double haOpenBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,3);
  double haCloseBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,3);
 
  double haLowBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,4);
  double haHighBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,4);
  double haOpenBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,4);
  double haCloseBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,4);
 
  double haLowBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,5);
  double haHighBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,5);
  double haOpenBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,5);
  double haCloseBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,5);
 
  double haLowBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,6);
  double haHighBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,6);
  double haOpenBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,6);
  double haCloseBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,6);
Does this look right if I want to pull out the last 7 bars worth of HA data? It seems long winded but if it looks correct to you, I'll plough on.

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 » Thu Jan 08, 2015 5:44 pm wrote:

Code: Select all

  double haLowBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,0);
  double haHighBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,0);
  double haOpenBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,0);
  double haCloseBar0 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,0);
 
  double haLowBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,1);
  double haHighBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,1);
  double haOpenBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,1);
  double haCloseBar1 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,1);
 
  double haLowBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,2);
  double haHighBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,2);
  double haOpenBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,2);
  double haCloseBar2 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,2);
 
  double haLowBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,3);
  double haHighBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,3);
  double haOpenBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,3);
  double haCloseBar3 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,3);
 
  double haLowBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,4);
  double haHighBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,4);
  double haOpenBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,4);
  double haCloseBar4 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,4);
 
  double haLowBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,5);
  double haHighBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,5);
  double haOpenBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,5);
  double haCloseBar5 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,5);
 
  double haLowBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,6);
  double haHighBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,1,6);
  double haOpenBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,2,6);
  double haCloseBar6 = iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,3,6);
Does this look right if I want to pull out the last 7 bars worth of HA data? It seems long winded but if it looks correct to you, I'll plough on.

Cheers
it would be easier if you would use arrays like :

Code: Select all

double haLowBar[7];// initializing array
//do the others the same way
//than
for (int i=7;i>=0;i--)
{
haLowBar[i]=iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,i);
//others in same way
}

 
if you want use less CPU resources you need only the i=0 reculate each tick and the others only every new bar, but for first steps this will be easier ..
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 » Thu Jan 08, 2015 5:54 pm wrote: it would be easier if you would use arrays like :

Code: Select all

double haLowBar[7];// initializing array
//do the others the same way
//than
for (int i=7;i>=0;i--)
{
haLowBar[i]=iCustom(NULL,TimeFrame,"MyHeikenAshi",Red,Green,Gray,Gray,0,i);
//others in same way
}

 
if you want use less CPU resources you need only the i=0 reculate each tick and the others only every new bar, but for first steps this will be easier ..
Cheers :)

Tommaso
Excellent, I forgot about the iteration loop. Cheers you are a rockstar!
.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Hi just need to confirm something please.

Is it possible to have

Code: Select all

(haCloseBar0 < haOpenBar0)
where haCloseBar0 should represent the Close of the current bar 0.

Or is there no such thing as a Close of bar 0, as bar 0 is always current bar in progress so its impossible to get a close of bar 0?

I seem to be confuddling myself again :< :arrrg:
.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Indicator Request

Post by milanese »

Angat » Sat Jan 10, 2015 9:53 am wrote:Hi just need to confirm something please.

Is it possible to have

Code: Select all

(haCloseBar0 < haOpenBar0)
where haCloseBar0 should represent the Close of the current bar 0.

Or is there no such thing as a Close of bar 0, as bar 0 is always current bar in progress so its impossible to get a close of bar 0?

I seem to be confuddling myself again :< :arrrg:
close of bar 0 is always the latest Bid, as no one can predict how an open bar will close in future ;)

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 »

I have put my HA variables within int Start() within a NewBar() function which pulls 5 HA corresponding bars for a particular bar.

Says the bar was X, it would pull back HA equilavent of X+2, X+1, X, X-1, X-2 using the icustom shift.

I'm not sure if this is the right way, coz now I want to do another check for the next bar i.e. the bar that comes next from X-2.

Another way of putting it would be I need the shift of -1.

Basically I want to create a CloseIfNextBarIsOpposite() function, but I think I have set my EA up wrong so far.

Is the right way, moving all HA Variables to the top out of int Start() and NewBar() then have a function in NewBar() that updates them.

I don't know. :arrrg:

Feels like 1 step forward, 2 steps back at the minute.
.
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 »

Angat » Sat Jan 10, 2015 7:15 pm wrote:I have put my HA variables within int Start() within a NewBar() function which pulls 5 HA corresponding bars for a particular bar.

Says the bar was X, it would pull back HA equilavent of X+2, X+1, X, X-1, X-2 using the icustom shift.

I'm not sure if this is the right way, coz now I want to do another check for the next bar i.e. the bar that comes next from X-2.

Another way of putting it would be I need the shift of -1.

Basically I want to create a CloseIfNextBarIsOpposite() function, but I think I have set my EA up wrong so far.

Is the right way, moving all HA Variables to the top out of int Start() and NewBar() then have a function in NewBar() that updates them.

I don't know. :arrrg:

Feels like 1 step forward, 2 steps back at the minute.
You cannot do this. A shift of -1 would be looking into the future, and that hasn't happened yet.

: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.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Okay I slept on it.

Name convention on HA Variables are confusing and needs to be changed so they are not referencing a fix candle.

I'm using a 3-5 candle pattern for entry with entry on the 6th but to use a 3-5 entry pattern and entry on the 4th,5th or 6th respectively - I'm going to need to completely recreate and add a lot more signals variables.

Also if there are 10 different types of candles for each position in the HA set of 7. There are a lot more permutations than I first thought.

Using array iterations would help I guess. I think I initially underestimated the work involved in making my entries.

At least I get what's going on now. The power of having a good sleep, eh. :smile:
.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Okay one question:

I'm trying to set an HA candle where the first complete bar's low is lower than the previous.

I thought it was (haLowBar1 < haLowBar2) where haLowBar1 should represent the first complete bar's low and haLowBar2 represents the previous.

But it's working out to be the opposite, anyone confirm?

That would mean that a 'Lower Low' is a bigger number than a 'Low'.

(I had a look at the HA indicator code, but I cant confirm.)

UPDATE: No one needs to confirm, I'm just going to go with it. I think that just how the HA Low's are calculated. The bigger the Low value the lower it actually is on a chart.
.
User avatar
Reaper
Trader
Posts: 476
Joined: Sat Feb 09, 2013 12:07 am
Location: UK

Indicator Request

Post by Reaper »

Angat » Sun Jan 11, 2015 1:57 pm wrote:Okay one question:

I'm trying to set an HA candle where the first complete bar's low is lower than the previous.

I thought it was (haLowBar1 < haLowBar2) where haLowBar1 should represent the first complete bar's low and haLowBar2 represents the previous.

But it's working out to be the opposite, anyone confirm?

That would mean that a 'Lower Low' is a bigger number than a 'Low'.

(I had a look at the HA indicator code, but I cant confirm.)

UPDATE: No one needs to confirm, I'm just going to go with it. I think that just how the HA Low's are calculated. The bigger the Low value the lower it actually is on a chart.
If anyone is wondering, I had another look in the HA indicator code and just realised what it meant.

Code: Select all

      if(open[0]<close[0])
        {
         ExtLowHighBuffer[0]=low[0];
         ExtHighLowBuffer[0]=high[0];
        }
      else
        {
         ExtLowHighBuffer[0]=high[0];
         ExtHighLowBuffer[0]=low[0];
        }

     
Damn Heiken Ashi, such a pretty indicator but so weirdly coded. :P
.
Post Reply

Return to “Utilities Indicators and Scripts”