start every day without close privious day

Forums ProRealTime English forum ProOrder support start every day without close privious day

Viewing 2 posts - 1 through 2 (of 2 total)
  • #174879

    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

    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)

Create your free account now and post your request to benefit from the help of the community
Register or Login