Pause Strategy when win X% or loss X%.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #150305 quote
    Fran55
    Participant
    Veteran

    How to Pause strategy when win X% or loss X% on weekly and monthly.

    Pause to Next week the weekly strategy.

    AndPause to Next month the montly strategy.

    Much thanks!!!

    #150328 quote
    robertogozzi
    Moderator
    Master
    // Monthly strategy
    //
    DEFPARAM CumulateOrders = false
    ONCE TradeON     = 1
    ONCE WinLoss     = 10
    ONCE Capital     = 10000
    ONCE PrevEquity  = Capital
    CurrEquity       = Capital + StrategyProfit
    IF Month <> Month[1] THEN
       TradeON    = 1
       PrevEquity = CurrEquity
    ENDIF
    TempProfit  = (CurrEquity - PrevEquity) * 100 / PrevEquity
    IF abs(TempProfit) >= WinLoss THEN
       TradeON = 0
    ENDIF
    IF close crosses over average[100] and TradeON then
       buy at market
       set target pprofit 200
       set stop   ploss   200
    endif
    if close crosses under average[100] and longonmarket then
       sell at market
    endif
    // Weekly strategy
    //
    DEFPARAM CumulateOrders = false
    ONCE TradeON     = 1
    ONCE WinLoss     = 10
    ONCE Capital     = 10000
    ONCE PrevEquity  = Capital
    CurrEquity       = Capital + StrategyProfit
    IF DayOfWeek < DayOfWeek[1] THEN
       TradeON    = 1
       PrevEquity = CurrEquity
    ENDIF
    TempProfit  = (CurrEquity - PrevEquity) * 100 / PrevEquity
    IF abs(TempProfit) >= WinLoss THEN
       TradeON = 0
    ENDIF
    IF close crosses over average[100] and TradeON then
       buy at market
       set target pprofit 200
       set stop   ploss   200
    endif
    if close crosses under average[100] and longonmarket then
       sell at market
    endif

    You can change the % (WinLoss) and the starting Capital as suits you best.

    #150333 quote
    Fran55
    Participant
    Veteran

    Thanks Roberto!

     

    I see tomorrow.

    #150392 quote
    Fran55
    Participant
    Veteran

    Ok Roberto, i see.

     

    But, win X% and loss X% are independents.

     

    For example:

    win 5% or loss 2%

    #150399 quote
    robertogozzi
    Moderator
    Master

    You wrote win X% or loss X%.

    I’ll change it soon.

    #150405 quote
    Fran55
    Participant
    Veteran

    Win X% or loss Y%?

     

    🙂

    #150406 quote
    robertogozzi
    Moderator
    Master

    There you go:

    // Monthly strategy
    //
    DEFPARAM CumulateOrders = false
    ONCE TradeON     = 1
    ONCE PerCentLoss = 3
    ONCE PerCentWin  = 5
    ONCE Capital     = 10000
    ONCE PrevEquity  = Capital
    CurrEquity       = Capital + StrategyProfit
    IF Month <> Month[1] THEN
       TradeON    = 1
       PrevEquity = CurrEquity
    ENDIF
    TempProfit  = (CurrEquity - PrevEquity) * 100 / PrevEquity
    IF (TempProfit <> 0) AND ((TempProfit >= PerCentWin) OR (TempProfit <= PerCentLoss)) THEN
       TradeON = 0
    ENDIF
    IF close crosses over average[100] and TradeON = 1 then
       buy 1 contract at market
       set target pprofit 200
       set stop   ploss   200
    endif
    if close crosses under average[100] and longonmarket then
       sell at market
    endif
    // Weekly strategy
    //
    DEFPARAM CumulateOrders = false
    ONCE TradeON     = 1
    ONCE PerCentLoss = 2
    ONCE PerCentWin  = 6
    ONCE Capital     = 10000
    ONCE PrevEquity  = Capital
    CurrEquity       = Capital + StrategyProfit
    IF DayOfWeek < DayOfWeek[1] THEN
       TradeON    = 1
       PrevEquity = CurrEquity
    ENDIF
    TempProfit  = (CurrEquity - PrevEquity) * 100 / PrevEquity
    IF (TempProfit <> 0) AND ((TempProfit >= PerCentWin) OR (TempProfit <= PerCentLoss)) THEN
       TradeON = 0
    ENDIF
    IF close crosses over average[100] and TradeON = 1 then
       buy at market
       set target pprofit 200
       set stop   ploss   200
    endif
    if close crosses under average[100] and longonmarket then
       sell at market
    endif
    #150419 quote
    Fran55
    Participant
    Veteran

    Only percentwin work.

     

    🙁

    #150425 quote
    robertogozzi
    Moderator
    Master

    At line 5 use a negative PerCentage, -2 or -5, or anything else.

    #150452 quote
    Fran55
    Participant
    Veteran

    Easy!

    Thanks Roberto.

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

Pause Strategy when win X% or loss X%.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Fran55 @fran55 Participant
Summary

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

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