Problem with the most simple trading system

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #25077 quote
    lollipop
    Participant
    New

    Hello,

    I feel stupid for this question because I can’t find the error even with the most simple trading system ever.

    I want to buy when the open price is above the moving average and sell when is under, but as you can see from the picture is not working.

    Thank you for support

    MA.png MA.png
    #25080 quote
    Elsborgtrading
    Participant
    Veteran

    Hi Lollipop, you condition is either false or true- always.

    Try something like

    c1= close crosses over MA
    
    
    
    #25125 quote
    lollipop
    Participant
    New

    Hello Elsborgtrading,

    thanks for answer, I am going to try your suggestion, but you are right, my condition is true or false, so why it opens a buy trade if the MA is over the price? By the way it should have open a short, right?

    thanks

    #25142 quote
    GraHal
    Participant
    Master

    @Lol Yes you are right, it should have been  SellShort.

    Sell would often exit the buy position at the next bar, as you suspected 🙂

    I often get stuck on ‘daft things’ also and instead of asking I bang, bang, bang my head against the wall for ages. I learn / teach myself in the end and it sticks in my mind that way, but I’m like a bear with a sore head while the angst is going on! 🙂 Much easier to ask, glad you did cos it meant I could help! 🙂

    Let us know how you get on.

    Cheers
    GraHal.

    #25143 quote
    GraHal
    Participant
    Master

    @Lol now I look again (in slower time) your code has correctly followed the logic, but as suggest, with a falling MA / below the open then maybe a SellShort might be more successful.

    Looking at the 3 bars in the circle …
    MA was below Bar 1 Open, so this condition triggered a Buy at Bar 2.
    MA was above Bar 1 Open so this conditions triggered a Sell at Bar 3.

    Cheers
    GraHal

    #25146 quote
    GraHal
    Participant
    Master

    Aghh fingers to fast again! That should be …

    MA was above Bar 2 Open so this conditions triggered a Sell at Bar 3.

    #25147 quote
    Eric
    Participant
    Master

    i try with a picture

    prt.png prt.png
    #25150 quote
    lollipop
    Participant
    New

    Sorry but it that case the code would be:

    c1 = MA < open[1]

    right?

    Instead I am making the calculation on the actual bar with open[0].

    Thanks

    #25151 quote
    GraHal
    Participant
    Master

    When a bar closes the conditions are checked so for example …

    On a 1 hour bar and time NOW 13:00 … then  MA < Open would be checked for MA < Open of the bar that ran from 12:00 to 13:00.

    On a 1 hour bar and time NOW 13:00 … MA < open[1] would be MA < Open of the bar that ran from 11:00 to 12:00.

    Note: On a 1 hour bar and time NOW 13:00 … Buy / Sell Orders triggered as above would be executed  at (next bar open) START of the bar than runs from 13:00 to 14:00.

    Hope that helps
    GraHal

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Problem with the most simple trading system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
lollipop @lollipop Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by GraHal
9 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/14/2017
Status: Active
Attachments: No files
Logo Logo
Loading...