count consecutive losing trades

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #131358 quote
    Thally
    Participant
    Average

    Hi Guys,

    does anyone have an idea of how to count consecutive losing trades. For example I want to stop trading if I take 3 losses in a row (i.e. one after the other), not a total of 3 losses for the day, but 3 losses in a row.

    Any ideas on how to code this out would be greatly appreciated

    Thanks

    #131359 quote
    Vonasi
    Moderator
    Master

    Use STRATEGYPROFIT.

    if strategyprofit < strategyprofit[1] then
    count = count + 1
    endif
    
    if strategyprofit > strategyprofit[1] then
    count = 0
    endif
    
    if count = 3 and (what ever condition you set to start trading again) then
    count = 0
    endif
    
    If (your entry conditions) and count < 3 then
    buy 1 contract at market
    endif
    Edmond and Thally thanked this post
    #131360 quote
    Thally
    Participant
    Average

    Thanks Vonsai. I tried that but StrategyProfit seems to be incorrectly counting losing trades. Look at the first example, the trade is profitable albeit a tiny profit but the counter counts it as a losing trade. Any idea what this happens?

    Screenshot-2020-05-12-at-18.37.30.png Screenshot-2020-05-12-at-18.37.30.png
    #131524 quote
    Nicolas
    Keymaster
    Master
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

count consecutive losing trades


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Thally @rodger_dodger Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Nicolas
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/12/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...