Stop trading after two consecutive losses in the same day

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44351 quote
    Juan Salas
    Participant
    Master

    Hi everyone,

    I am trying to put together a piece of code for a reverse order as a stop loss, and sometimes end it up losing three or four operations in a row in just one day.

    It works most of the times, especially when we have a drastic fall or raise in price (i.e, crude). What I am trying to do is to take advantage of that strength of the market, reverse and follow the trend to mitigate my initial losses. I have check the backtest and there are few occasions when after one of two big candles the market loose strength and become lateral and the operations start going in the opposite/wrong direction.

    I would like to limit these losses to two per day maximum, so can anyone tell me how I could stop the system after two consecutive losses the SAME DAY??????

    Is that even possible??

    Thanks,

    Juan

    #44368 quote
    Wing
    Participant
    Veteran
    once TradesToday=0
    
    if time=000000 then
    TradesToday=0
    endif
    
    If TradesToday>1 and positionperf(1)<0 and positionperf(2)<0 and onmarket=0
    Quit
    endif
    
    // for every trade you make:
    TradesToday=TradesToday+1
    
    

    Something like that?

    #44390 quote
    Juan Salas
    Participant
    Master

    Hi Wing,

    It seems perfect. I am going to try it and will let you know the results.

    Thanks so much for your help.

    Juan

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

Stop trading after two consecutive losses in the same day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Juan Salas
8 years, 6 months ago.

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