Topic: Two Bars Action

hello
i tried to made some modifications to build  a simple two bars action but iam completely stucked in the calculation part

attached the indicator , any one can help to make it works

Thanks in advance

Re: Two Bars Action

You are almost there.

All these blocks:

                    for (int iBar = iPrvs + 1; iBar < Bars; iBar++)
                    {
                        Close[bar - 1] > Close[bar - 2] ? 1 : 0;
                        Close[bar - 1] > Close[bar - 2] ? 1 : 0;
                    }

Must be:

                    for (int bar = iPrvs + 1; bar < Bars; bar++)
                    {
                        Component[1].Value[bar] = Close[bar - 1] > Close[bar - 2] ? 1 : 0;
                        Component[2].Value[bar] = Close[bar - 1] > Close[bar - 2] ? 1 : 0;
                    }

Note iBar changed to bar

Re: Two Bars Action

Many Thanks Pop

I modified the mentioned parts in previous post

But still cannot modify the start of calculate part

Post's attachments

TwoBars.cs 18.07 kb, 16 downloads since 2013-06-08 

You don't have the permssions to download the attachments of this post.

Re: Two Bars Action

How to change this part from volume to fit to the two bars indicator

public override void Calculate(IDataSet dataSet)
        {
            DataSet = dataSet;

            // Reading the parameters
            int    iPrvs  = IndParam.CheckParam[0].Checked ? 1 : 0;

            // Calculation
            double[] adVolumes = new double[Bars];

             int iFirstBar = iPrvs + 1;

             for (int iBar = 0; iBar < Bars; iBar++)
             {
                  adVolumes[iBar] = Volume[iBar];
              }

And this

Component[0].Value     = adVolumes;

Re: Two Bars Action

Ahmed, explain more, make a drawing  or something, don't understand nothing. smile

Re: Two Bars Action

i am trying to modify the volumes indicator into two price action indicator

the idea is compare OHLC to OHLC of previous bar but iam stucked when i wanted to change volume variable to in the beginning of calculation block

Re: Two Bars Action

You want to compare volume of previous bars?

Re: Two Bars Action

no i need to use High , open , Low and close  instead of volume

Re: Two Bars Action

hello footon
attached here the simple version of the indicator i need.
i used only high value , but what i need to include ohlc values in one indicator to save slots '' max are 8 ''

Post's attachments

Highs.cs 6.35 kb, 7 downloads since 2013-06-11 

You don't have the permssions to download the attachments of this post.

Re: Two Bars Action

Ok, this makes more sense. The first indi you posted - you do not need calculation block at all (if you want fancy chart action, then you'll need it). As far as I saw signal calculation takes place in the Calculation of the logic part.

One other interesting thing I noticed - your logics give buy and sell signals at the same time, is it intentional?

Re: Two Bars Action

footon wrote:

Ok, this makes more sense. The first indi you posted - you do not need calculation block at all (if you want fancy chart action, then you'll need it). As far as I saw signal calculation takes place in the Calculation of the logic part

how to make it without calculation part !!!!  could you modify the 1st indicator please

Re: Two Bars Action

Have you checked the signals? Are they to your liking?

You can leave it as it is, what you see in the histogram is some daft values, but they don't interfere with the trading signals indi gives, you have to check the signals and go on from there.

Re: Two Bars Action

footon wrote:

One other interesting thing I noticed - your logics give buy and sell signals at the same time, is it intentional?

How is that !!!!  the idea of the indicator to be undirectional not giving signals alone it needs other indicator or opening point that trigger entry !!!! 

Could you elaborate more

Re: Two Bars Action

Yep, it is intentional then.

ahmedalhoseny wrote:

the idea of the indicator to be undirectional not giving signals alone it needs other indicator or opening point that trigger entry!

That's exactly how it is going to work, when FSB sees 2 opposite signals, it won't open a position unless there is a third directional signal. It's all ok smile

Re: Two Bars Action

footon wrote:

Yep, it is intentional then.

ahmedalhoseny wrote:

the idea of the indicator to be undirectional not giving signals alone it needs other indicator or opening point that trigger entry!

That's exactly how it is going to work, when FSB sees 2 opposite signals, it won't open a position unless there is a third directional signal. It's all ok smile

loooooooooooooool  so kindly may you modify the 1st indicator

Re: Two Bars Action

Modify what?

Re: Two Bars Action

Two bars indicator  its not working !!!

Re: Two Bars Action

ahmedalhoseny wrote:

Two bars indicator  its not working !!!

Could you elaborate more on that? From what you say it's not working?

Re: Two Bars Action

it cannot load

see attached pic

Post's attachments

cannot load.png
cannot load.png 15.58 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Two Bars Action

Delete the for loop in the calc block, put only a number for the iFirstBar, component numbers are fine?

Second option - find a working custom indi, copy/paste logic parameter, logic calculation block and description block and it works, it did for me anyway, has to work for you, too.