Tradecounter does not work

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #176587 quote
    phoentzs
    Participant
    Master

    Sorry for the maybe stupid question. I’ve been working on this little breakout system for hours now. But I can’t get the Tradecounter to work. It doesn’t open any trades. What am I doing wrong? It should be able to open a trade once a day in each direction. So a maximum of once long and once short. Somehow I can’t get the counter loop through. Could anyone help me, please?

     

    DEFPARAM CumulateOrders = FALSE
    Defparam Preloadbars = 1000
    defparam Flatafter = 210000
    
    ONCE TradeLong = 0
    ONCE TradeShort = 0
    IF IntraDayBarIndex = 0 THEN
    TradeLong = 0
    TradeShort = 0
    ENDIF
    
    dis = 20
    hl = dis
    gl = hl + 10
    //start = hl
    
    IF Time = 080000 THEN
    EntryLong = close + dis * pipsize
    EntryShort = close - dis * pipsize
    ENDIF
    
    IF Time >= 080000 AND Time <= 140000 THEN
    
    IF EntryLong and not tradelong THEN
    BUY 1 Contract AT EntryLong STOP
    SET STOP pLOSS hl
    SET TARGET pPROFIT gl
    Tradelong = 1
    ENDIF
    
    IF EntryShort and not tradeshort THEN
    SELLSHORT 1 Contract AT EntryShort STOP
    SET STOP pLOSS hl
    SET TARGET pPROFIT gl
    tradeshort = 1
    ENDIF
    endif
    #176588 quote
    Nicolas
    Keymaster
    Master

    You put STOP orders and increment your variable Tradelong and Tradeshort. But that stop orders might not trigger, so you are counting for nothing.

    #176589 quote
    phoentzs
    Participant
    Master

    Without a tradecounter, the stop orders are triggered. But not with Tradecounter. Can you try EurUsd Mini M1 was my attempt.

    #176592 quote
    phoentzs
    Participant
    Master

    Ha, I have it. the counter has to get out of the loop for stop orders and only count when the order is triggered and you are in the market. Thank you anyway.

    My Insert Code button doesn’t exist.

     

    if longonmarket then
    Tradelong = 1
    endif
    if shortonmarket then
    tradeshort = 1
    endif

    Nicolas thanked this post
    #176593 quote
    phoentzs
    Participant
    Master

    Yes, sorry.

    if longonmarket then
    Tradelong = 1
    endif
    if shortonmarket then
    tradeshort = 1
    endif
    #176630 quote
    murre87
    Participant
    Senior

    Sorry for a stupid question. What do u do with the counter? Resultscreen show you how many trade the algo have done?

    #176631 quote
    phoentzs
    Participant
    Master

    No, the other way around. You can use it to determine how many trades can be made in one day in each direction. In this case, one trade long, one trade short maximum per day.

    #176870 quote
    Bob Harris
    Participant
    Average

    Hi,

    If you fix the counter issue and it still isn’t putting trades or it is erratic when it goes live, on you may want to try using “Buy at Market” rather than using a “buy stop” at the market level

    #176893 quote
    phoentzs
    Participant
    Master

    Yes I know. But I wanted to build the strategy with stop orders.

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

Tradecounter does not work


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by phoentzs
4 years, 5 months ago.

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