Entry, Exit and Profit coding in autotrading

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17550 quote
    Lasse
    Participant
    New

    Hi,

    I am trying to code an auto-traded strategy but would need some “basic” help to complete it as I am still new to the programming – so straight to the Questions:

    • Q1 – Exit: In the auto trading function you will by default exit at market price, next bar open. I rather want to exit at current bar 5 minutes before closing. How to code that?
    • Q2 – Entry: By default, you enter at market price, next bar open. I rather want to enter next bar open IF e.g. +0.2% above prev candle high. How to code that?
    • Q3 – Profit: At previous structure high (looking e.g. 20 days back). How to code that?

     

    Many thanks in advance! Examples are appreciated too.

     

    Lasse

    #17572 quote
    Nicolas
    Keymaster
    Master

    Please find below answers to your 3 questions:

    1/ Not possible until the multi-timeframe is available in the coding languag

    2/ You need to place on market a pending STOP order at current high price * 0.002 , it will only last 1 candlestick:

    BUY 1 SHARE AT high*1.002 STOP

    3/ First define the profit in points between the 20 days back highest high and the current close (price when the calculation will be made):

    takeprofit = highest[20](high)[1]-close

    then set your takeprofit in your code with this instruction:

    SET TARGET PROFIT takeprofit
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Entry, Exit and Profit coding in autotrading


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Lasse @lasse Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/30/2016
Status: Active
Attachments: No files
Logo Logo
Loading...