need help for conditional entry

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #189213 quote
    Swisspatrick
    Participant
    New

    hi! I am having difficulties to implement an index based strategy and need help. It’s not about the pattern, but about the conditional entry that I need help.

    Setup of the pattern could be like

    1. take any condition to be true for the pattern today, e.g. high-low > 5
    2. when the pattern is true today, enter long tomorrow (and only tomorrow), but only when tomorrow’s high is higher than today’s high.

    The condition under 2) is like a stop-entry.

    Would be thankful if any of you could guide me with a very short code structure given the info above. Thank you.

    #189264 quote
    robertogozzi
    Moderator
    Master

    There you go:

    PatternToday = range > 5*PipSize   //range = high - low
    IF high > high[1] AND PatternToday[1] AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
    Midlanddave thanked this post
    #191154 quote
    Swisspatrick
    Participant
    New

    Dear Roberto,

    thank you for your reply. It worked well and I would like to enhance it.
    What do you need to add to:

    • trigger a buy only if the pattern happened in the last 3 bars
    • as the entry condition, take the high on the day when the pattern happened (which can be any of the 3 days)

    thank you ahead.

    #191188 quote
    robertogozzi
    Moderator
    Master

    There you go:

    PatternToday = range > 5*PipSize   //range = high - low
    IF PatternToday THEN
       EntryPrice = HIGH
    ENDIF
    IF high > EntryPrice AND Summation[3](PatternToday) AND Not OnMarket THEN
       BUY 1 CONTRACT AT MARKET
    ENDIF
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

need help for conditional entry


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
3 years, 10 months ago.

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