start every day without close privious day

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #174879 quote
    hhintzen
    Participant
    Junior

    I want my strategy to start every day 5 times, with 3 contrats and target 5.
    If the traget is not reached on one day, the strategy must restart the next day again, without closing the previous position (day).

    This previous position only allowd to close if target is achieved.

    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
    // Het systeem zal alle lopende orders annuleren en alle posities sluiten om 0:00. Er zijn geen nieuwe toegestaan totdat na de “FLATBEFORE” tijd.
    //DefParam FlatBefore = 090000
    //DefParam FlatAfter = 230000

    // Voorkomt dat het systeem handelt op specifieke dagen van de week
    //daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 4 OR OpenDayOfWeek = 5

    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    MyConditions = (open <= WeightedAverage[14](medianPrice))

    Once TradeON = 2
    If IntraDayBarIndex = 0 then
    TradeON = 5
    Endif

    //If OnMarket or StrategyProfit <> StrategyProfit[1] Then
    //TradeON = 0
    //endif

    If MyConditions and TradeON and Not DaysForbiddenEntry and time >= 090000 and time <= 230000 and Not OnMarket Then
    Sellshort 3 CONTRACT AT MARKET
    TradeON = TradeON – 1
    Endif

    // Stops and targets
    //SET STOP ptrailing 15
    SET TARGET pPROFIT 5
    //graph MyConditions
    //graph TradeON

    #174907 quote
    robertogozzi
    Moderator
    Master

    Thank you for sharing your code.

    Can you post performance data (with instrument, TF and units)?

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

start every day without close privious day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
hhintzen @hhintzen Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
4 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/07/2021
Status: Active
Attachments: No files
Logo Logo
Loading...