Topic: Testing simple price behavior

I like to examine a strategy based on these two conditions

Buy
if ((Open < Lo[1]) and (Hi > Lo[1]))

Sell
if ((Close > Close[1]) and (Close < Open) and (H i> (Hi[2] and Close[3]))

[#] indicate bar position for example [1] =previous bar, [2]= two periods ago

Problem I am having is not able to select OHLC using the indicator window and I am not at all familiar on how to make an indicator for each of these conditions (to by pass looking for OHLC price).

Any guidance will be greatly appreciated.

Re: Testing simple price behavior

This is my try on this:
[Opening Point of the Position]
Bar Opening
     Enter the market at the beginning of the bar
     Base price  -  Open

[Opening Logic Condition]
Moving Average
     [ A ]   The bar opens below the Moving Average
     Smoothing method  -  Simple
     Base price  -  Low
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ A ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Low
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ A ]   Open long positions only

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  Close
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Moving Average
     [ B ]   The bar opens above the Moving Average
     Smoothing method  -  Simple
     Base price  -  Close
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  High
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ B ]   Open short positions only

Re: Testing simple price behavior

footon wrote:

This is my try on this:
[Opening Point of the Position]
Bar Opening
     Enter the market at the beginning of the bar
     Base price  -  Open

[Opening Logic Condition]
Moving Average
     [ A ]   The bar opens below the Moving Average
     Smoothing method  -  Simple
     Base price  -  Low
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ A ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Low
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ A ]   Open long positions only

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  Close
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Moving Average
     [ B ]   The bar opens above the Moving Average
     Smoothing method  -  Simple
     Base price  -  Close
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  High
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ B ]   Open short positions only

Thanks for your help. Unfortunately I don't see "Custom Moving Averages Crossover" among the indicators in the program. I do have the most updated version. I only see "Moving Average Crossover" which only allows selecting only one base price instead of FastBase and SlowBase. Please clarify. Thanks

Re: Testing simple price behavior

You can download it here:
http://forexsb.com/forum/topic/649/moving-average-crossover/

Re: Testing simple price behavior

footon wrote:

This is my try on this:
[Opening Point of the Position]
Bar Opening
     Enter the market at the beginning of the bar
     Base price  -  Open

[Opening Logic Condition]
Moving Average
     [ A ]   The bar opens below the Moving Average
     Smoothing method  -  Simple
     Base price  -  Low
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ A ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Low
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ A ]   Open long positions only

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  Close
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  1
     Use previous bar value  -  Yes

[Opening Logic Condition]
Moving Average
     [ B ]   The bar opens above the Moving Average
     Smoothing method  -  Simple
     Base price  -  Close
     Period  -  1
     Shift  -  0
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  High
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Custom Moving Averages Crossover
     [ B ]   The Fast MA is higher than the Slow MA
     FastBase price  -  High
     SlowBase price  -  Close
     Fast MA method  -  Simple
     Slow MA method  -  Simple
     Fast MA period  -  1
     Slow MA period  -  1
     Fast MA shift  -  0
     Slow MA shift  -  2
     Use previous bar value  -  Yes

[Opening Logic Condition]
Long or Short
     [ B ]   Open short positions only

I did download the MA indicator.
All of above is meant to go in Opening logic. Right?
What I want is use the Buy formula for opening the position and Sell formula to Close it. If I try to add the sell parts in Closing logic , I don't have an option to use previous bar value. Plus, I get no trades.

Re: Testing simple price behavior

Jagmanmick wrote:

You can download it here:
http://forexsb.com/forum/topic/649/moving-average-crossover/

Thanks. Still struggling to make the setup work.

Re: Testing simple price behavior

In strategy properties would changing the opposite direction signal to close work.

Re: Testing simple price behavior

Is this the logic your looking for
Long Trade
(Open[iBar - 1] < Low[iBar - 2] &&
High[iBar - 1] > Low[iBar - 2])

Short Trade
(Close[iBar - 1] > Close[iBar - 2] &&
Close[iBar - 1] < Open[iBar - 1] &&
High[iBar - 1] > High[iBar - 3] &&
High[iBar - 1] > Close[iBar - 4])

Mick

Re: Testing simple price behavior

Jagmanmick wrote:

Is this the logic your looking for
Long Trade
( &&
High[iBar - 1] > Low[iBar - 2])

Short Trade
(Close[iBar - 1] > Close[iBar - 2] &&
Close[iBar - 1] < Open[iBar - 1] &&
High[iBar - 1] > High[iBar - 3] &&
High[iBar - 1] > Close[iBar - 4])

Mick

Mick, going for custom indi? Good effort, probably the best way to achieve this.

I would change the first line though,
to this

Open[iBar] < Low[iBar - 1]

What do you or Harapa think about this? Open is known practically every step of the way, and is more closer to the original code. BTW, is it taken from a Tradestation indi?

Thanks and good luck!

Re: Testing simple price behavior

Hi footon,
That first line change works well, lets hope Harapa likes it.
Mick

Re: Testing simple price behavior

Jagmanmick wrote:

Is this the logic your looking for
Long Trade
(Open[iBar - 1] < Low[iBar - 2] &&
High[iBar - 1] > Low[iBar - 2])

Short Trade
(Close[iBar - 1] > Close[iBar - 2] &&
Close[iBar - 1] < Open[iBar - 1] &&
High[iBar - 1] > High[iBar - 3] &&
High[iBar - 1] > Close[iBar - 4])

Mick

Yes, this is what I am looking for. I would prefer if I can test this as "long only" as well as "long and short".
Thanks for your help.

Post's attachments

Smll_Cap_ST.png 139.95 kb, 2 downloads since 2012-04-21 

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

Re: Testing simple price behavior

Hi harapa,
Attached is the indi I've done with the change suggested by footon (you can change it back if you prefer). To test it long add the "long or short" indi to your strat. Modify the indi code to suit your ideas.
Hope it helps,
Mick

Post's attachments

Simple Price Action.cs 4.09 kb, 7 downloads since 2012-04-22 

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

Re: Testing simple price behavior

Thanks a lot. It just needed a small adjustment that I didn't realize when I looked at set up the first time. Here is the amendment that translated correctly what I had described in the first post.

if (Open[iBar] < Low[iBar - 1] &&
                    High[iBar] > Low[iBar - 1])
                   
                    adUp[iBar] = 1;
                   
                                                   
                // Short trade
                if (Close[iBar] > Close[iBar - 1] &&
                    Close[iBar] < Open[iBar] &&
                    High[iBar] > High[iBar - 2] &&
                    High[iBar] > Close[iBar - 3])

Now to expand this  further.

First
Is it possible to split the indicator into two different files one for buy and other for sell set up. If yes then is a preferred mode because I want to add multiple selectable buy or sell options.

Secondly
How would you go about appending two selectable buy or sell options as a part of buy or sell indicator.

Here is an example of another buy/sell setup
Buy: ((O =< H[1]) and (O >= L[1]) and (H > H[1]))
Sell: ((O =< H[1]) and (O >= L[1]) and (L > L[1]))

Thanks for your help

Re: Testing simple price behavior

Hi harapa,
If I've got this wrong I hope someone will correct me.
As I understand it the iBar is the entry Bar and we work back from there, so the first Bar we use is [iBar - 1] hence the coding I've written. The only thing we know about the iBar is it'll Open at a price somewhere.
If you want to split the indicator no problem you will need to ensure the names are different otherwise FSB will refuse to load it and give you a warning message.
You can add the additional buy or sell options you've specified to the indi I supplied or modify any others you already have.
Mick

Re: Testing simple price behavior

Jagmanmick wrote:

Hi harapa,

You can add the additional buy or sell options you've specified to the indi I supplied or modify any others you already have.
Mick

I am not a  programmer so am clueless as to how to split this into two files one for buy and one for sell as well as how to append more buy sell options. If you can split this indicator into buy sell and add one item from second set this way I may learn how to do this kind of task in future. Appreciate your help.

Re: Testing simple price behavior

Jagmanmick wrote:

Hi harapa,
If I've got this wrong I hope someone will correct me.
As I understand it the iBar is the entry Bar and we work back from there, so the first Bar we use is [iBar - 1] hence the coding I've written. The only thing we know about the iBar is it'll Open at a price somewhere.
Mick

Absolutely correct! It can be made to work with iBar too, then Up[iBar+1]=1, but this change is cosmetical, indi works the same both ways.

Re: Testing simple price behavior

harapa wrote:

I am not a  programmer so am clueless as to how to split this into two files one for buy and one for sell as well as how to append more buy sell options. If you can split this indicator into buy sell and add one item from second set this way I may learn how to do this kind of task in future. Appreciate your help.

Splitting the file will not stop any other indi you add to your strategy giving a short/long signal but using the "Long or Short" indi with your Simple Price Action indi will ensure all indi's give the selected direction only which I presume that is what you want.
I have added the options you suggested to the previous file and also included the split files with  Long and Short only so you can see what effect they have.
You can then open them and modify them adding any other options you require.

Mick

Post's attachments

Simple Price Action.zip 3.53 kb, 4 downloads since 2012-04-23 

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

Re: Testing simple price behavior

Mick,
Thanks for your help. I now have some thing to play around.
Harapa