Quit trading Strat – on same day

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #158153 quote
    Monobrow
    Participant
    Senior

    Hi All

    I’ve been using this code to quit trading from the forum (thank you!), but figured it would be “even better”, if it could be adjusted so it only quits for trades lost in succession on the same day/period. I’m less worried about losses over multiple days as “stuff happens”, but on the same day its usually not going to be good for my algo!

    I had a go with using Today, but couldnt figure out how to work out what the day was 🙁

    // QUIT Trading Strat
    if strategyprofit <> strategyprofit[1] then
    if positionperf(1)<0 then
    Count=Count+1
    else
    Count=0
    endif
    endif
    
    if Count >=3 then
    QUIT
    endif

     

     

    I’m hopeful one of you Pro’s can help 🙂

    Thanks!

    #158163 quote
    Monobrow
    Participant
    Senior

    Haha, im an idtiot, was pretty simple in the end 🙂

    // QUIT Trading Strat
    if strategyprofit <> strategyprofit[1] then
    if positionperf(1)<0 and Day=Day[1] then
    Count=Count+1
    else
    Count=0
    endif
    endif
    
    if Count >=3 then
    QUIT
    endif

    just changed line 3, idk if this is the best way, but it did what I wanted, also open to smarter ideas, or ideas where we can define more specific periods . thanks!

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

Quit trading Strat – on same day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Monobrow @monobrow Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Monobrow
5 years, 1 month ago.

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