programming moving average & multiple entries

Forums ProRealTime English forum ProOrder support programming moving average & multiple entries

Viewing 5 posts - 1 through 5 (of 5 total)
  • #78082

    Hi, I am a first time user and trying to automate and back test a strategy:

    1. On the simple creation I have set up on the hour chart a buy and sell strategy. However, I only want to buy when the price is above 20 moving average on the weekly chart and sell when the price is below the 20 moving average on the weekly chart. Is this possible over different time frames, if not how is it done on the same time frame.
    2. After my initial entry, I would also like to enter the market every 50 points until it reaches my exit point; and then exit all positions. e.g. – If two moving averages haven’t crossed to give me my exit I want to keep adding to my position until they cross.

    Can I have some help coding this please?

    Thanks, Rob

    #78087

    Number 1 is easy but bear in mind that MTF is currently only under test in demo mode so you can’t trade something like this live just yet:

    Run it on an hourly chart and this should just buy at the close of every hourly candle if it is above the weekly[20] average and sell if it is below. This weekly average is updated every hour. If you want to use the start of the week average at a fixed level then change the DEFAULT in line 1 to UPDATEONCLOSE.

    You will need to clarify number two a little more. Do you want to buy every time price moves 50 pips in your favour or 50 pips against you?

     

    #78090

    This might be the sort of thing you are looking for in number 2?

    #78142

    Hi Vonasi,

    Thanks for your help – the MTF coding isn’t doing what I was looking for.

    I already have 4 commands; c1 buy, c2 sell, c3 sellshort, c4 exitshort on the hourly chart. Picture two moving averages e.g. a 10 & 50, each time the 10 crosses over the 50, my strategy buys. Then when the 10 crosses under the 50 it closes the long and opens a short and so on. I want the buy to happen only when the price is trading above a weekly 20 moving average – this limits my exposure in the market and therefore having less entries.

    I want it to only execute c1-c2 when the weekly moving average is above 20, and only execute c3-c4 when the weekly moving average is below 20? Can this be done…?

    With my number 2 question – I want to buy every time it moves 50 pips against me (haven’t tried this code yet as I need to get weekly moving average working first).

    Many thanks,

    Rob

    #78149

    Not tested and not sure it is what you want as your strategy description is a little difficult to interpret.

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login