Help to code a strategy about percentage increase or decrease for OMXS30

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #88917 quote
    alipour81alipour81
    Participant
    New

    Hi,
    I’m new at trading and programming so I wonder if someone can help me to code this for me so I can get started. My request:

    Underlying asset: Sverige30 Cash (20sk) Index

    Open position after 17:30, after hours trading

    Buy when > 1 % down
    Take profit if increases 0,5%
    Take loss if decreases 0,25%

    Sell when > 1% up
    Take profit if decreases 0,5%
    Take loss if increases 0,25%

    Close position at 08:59 day after, before opening hours

    Trade size: 20

    #88918 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I assume you want to use it on a 1-minute TF, don’t you?

    1% compared to previous day closing price?

    #88919 quote
    alipour81alipour81
    Participant
    New

    Yes thats right, 1-minute TF.
    When the market close 17:30, after that 1% compared with closing price

    #88922 quote
    NicolasNicolas
    Keymaster
    Legend
    • For a new topic, your title should be explicit enough to prompt the community to read your discussion.

    “code help” is not explicit enough.

    #88925 quote
    alipour81alipour81
    Participant
    New

    @Nicolas: What do you suggest for a title?

    #88930 quote
    NicolasNicolas
    Keymaster
    Legend

    The one I wrote in replacement, for example 😉

    #88931 quote
    swappingswapping
    Participant
    Master

    @alipour , by exemple simple title  : suede index market strategy

    #88932 quote
    alipour81alipour81
    Participant
    New

    @nicolas: hahaha yes I saw that. Thanks

    #88963 quote
    alipour81alipour81
    Participant
    New

    @robertogozzi,
    Yes thats right, 1-minute TF.
    When the market close 17:30, after that 1% compared with closing price

    #88979 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Try this one:

    DEFPARAM CumulateOrders = false
    TradeOFF = opentime >= 090000 AND opentime <= 173000
    ClosingPrice = 0
    IF OnMarket AND time = 085900 THEN
       SELL      AT MARKET
       EXITSHORT AT MARKET
    ENDIF
    IF LongOnMarket THEN
       IF (close >= (TradePrice * 1.005)) OR (close <= (TradePrice * 0.975)) THEN
          SELL AT MARKET
       ENDIF
    ELSIF ShortOnMarket THEN
       IF (close <= (TradePrice * 0.995)) OR (close >= (TradePrice * 1.025)) THEN
          EXITSHORT AT MARKET
       ENDIF
    ENDIF
    IF OpenTime = 173000 THEN
       ClosingPrice = close
    ENDIF
    IF Not OnMarket AND Not TradeOFF THEN
       IF close >= (ClosingPrice * 1.01) THEN
          BUY 1 CONTRACT AT MARKET
       ELSIF close <= (ClosingPrice * 0.99) THEN
          SELLSHORT 1 CONTRACT AT MARKET
       ENDIF
    ENDIF
    Bard thanked this post
    #88997 quote
    mbappembappe
    Participant
    New

    @alipour , by exemple simple title : suede index market strategy


    @swapping
    Hi, can i get in touch with you private? =)

    #89000 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    No private info can be posted.

    Any member willing to contact other members can only do this with the help of ADMIN. Contact him first.

    #89046 quote
    alipour81alipour81
    Participant
    New

    @robertogozzi
    thank you for your help.

    Is it possbile to back track this strategy?

    #89047 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    You can backtest it as any other strategy with ProBackTest. You can launch it from ProOrder after creating the strategy using Copy & Paste.

    To read and learn more about ProBackTesting:

    https://www.prorealcode.com/blog/debugging-probuilder-graph-instruction/

    https://www.prorealcode.com/blog/video-tutorials/tick-tick-backtest-engine-probacktest/

    https://www.prorealcode.com/blog/learning/prorealtime-walk-analysis-tool/

    #89120 quote
    alipour81alipour81
    Participant
    New

    @robertogozzi

    In your code, Where does it say wich index to buy?

    And if I want to have a trailing stop loss 0,5 instead of regular stop loss, and I want the volume to be low, how can I code that?

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Help to code a strategy about percentage increase or decrease for OMXS30


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
alipour81 @alipour81 Participant
Summary

This topic contains 17 replies,
has 6 voices, and was last updated by VonasiVonasi
7 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/17/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...