stop loss in USDJPY trading strategy – 1minTF – SAR and EMA

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #150439 quote
    swiezak
    Participant
    Average

    Hi

    Is possible to put in code stop loss variables betwen 100 and 500 or just stop loss that loss not excess 100 any  trade

    Please help my any idea ??

    DEFPARAM CumulateOrders = false
    //INDICATORS//
    mm3= exponentialaverage[200*3]
    mm2= exponentialaverage[200*1.5]
    mm1= exponentialaverage[200*1]
    PARABOLIC = SAR[0.001,0.001,0.2]
    C1 = PARABOLIC>HIGH //RED SAR = SHORT
    C2 = PARABOLIC<LOW //GREEN SAR = LONG
    Spread = 1.1
    //
    
    //MONEY MGT//
    Equity = (Strategyprofit+20000)
    Risk = round(Equity/100000)
    Losses = positionperf(1)<0 and positionperf(2)<0 and positionperf(3)<0
    streak = positionperf(1)>0 and positionperf(2)>0 and positionperf(3)>0
    if losses then
    n = max(abs(round(max(3+risk-2,risk-2))),2)
    elsif not losses then
    n = max(abs(round(max(3+risk,risk))),2)
    endif
    if streak then
    n = max(abs(round(max(5+risk,risk))),2)
    endif
    //
    
    T1 = (barindex-tradeindex>=3)
    T2 = (barindex-tradeindex>=3)
    
    //ENTER LONG//
    if (mm1>mm2 and mm2>mm3) and c2 AND T1 then
    buy n contract at breakeven+spread*pipsize limit
    breakeven = parabolic
    if T2 and longonmarket then
    sellshort at breakeven+spread*pipsize stop
    endif
    endif
    
    //ENTER SHORT//
    if (mm1<mm2 and mm2<mm3) and c1 and T1 then
    sellshort n contract at breakeven-spread*pipsize limit
    breakeven = parabolic
    if T2 and shortonmarket then
    exitshort at breakeven-spread*pipsize stop
    endif
    endif
    USDJPY_AVGSAR_2.itf
    #150444 quote
    robertogozzi
    Moderator
    Master

    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    Thank you 🙂

    #150668 quote
    Nicolas
    Keymaster
    Master

    You can set a stop loss at 100$ with:

    set stop $loss 100

    But since you are using dynamic position size, the stoploss size in points could be very tight sometimes (if position size is big).

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

stop loss in USDJPY trading strategy – 1minTF – SAR and EMA


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
swiezak @swiezak Participant
Summary

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

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