Volatility Scalper S1 V01

Viewing 15 posts - 1 through 15 (of 49 total)
  • Author
    Posts
  • #124472 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    Hi,

    I tried to make a strategy based on Volatility Scalper Indicator of Nicolas. As a reminder, this indicator detects the high volatility of market places. It’s the reflect when the market is making big move on the same bar.

    This strategy is based on this indicator.

    • When the value of the upside volume is considered as good, value > treshold and close > long MM, ->  buy position is taken.
    • When the value of the downside volume is considered as good, value > treshold and close < long MM, ->  sell position is taken.
    • Stop according to traling stop
    • time 1530 – 2200, everyday
    • option / reversal position size (possibility to activate or not)
    • option for buy, sell or both

    all suggestions are open…

    • maybe specify more precise time ranges according to the volatility of DJI, same thing for different days… ?
    • others ?
    • …
    • others.. ?

     

    //VOLATILITY SCALPER STRATEGY
    //@MAKSIDE - 2020
    //V0.1
    
    // Définition des paramètres du code
    DEFPARAM CumulateOrders = False // Cumul des positions désactivé
    
    //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Volatility Scalper
    //@Nicolas/PRT
    // Variables
    threshATRPeriod = 40
    smoothing = 2
    verticalShiftPercent = 0
    // --
    
    threshATRPeriod = max(1, threshATRPeriod)
    smoothing = max(1, smoothing)
    
    diff = averagetruerange[1] - averagetruerange[2]
    if(close-close[1])>0 THEN
    upsidevol = averagetruerange[1] + diff * 0.5
    upsideVol = max(upsideVol, 0)
    downsidevol = 0
    ELSE
    upsidevol = 0
    downsidevol = averagetruerange[1] + diff * 0.5
    downsideVol = max(downsideVol, 0)
    ENDIF
    
    t = DEMA[smoothing](AverageTrueRange[threshATRPeriod])
    t = t + (t*(verticalShiftPercent/100))
    //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    
    //PARAMETERS OF STRATEGY **************************************
    //level of volatility indicator / bull market
    Cupsidevol = 10
    //level of volatility indicator / bear market
    CdownsideVol = 20
    //buy conditions
    Cdatetimebuy = (CurrentTime > 153000) and currenttime < 220000
    //sell conditions
    Cdatetimesell = (CurrentTime > 153000) and currenttime < 220000
    Cbuy = upsidevol>Cupsidevol and upsidevol > t and Cdatetimebuy
    Csell = downsidevol>CdownsideVol and downsidevol > t and Cdatetimesell
    
    // Strategy - 1 : buy, 2 : sell, 3 : both
    Cchoice = 2
    
    //Reverse martingale 1 : ON, 0 : OFF
    levier = 1
    n = 1
    
    reversemartingale = 0
    //$$$$$$$$$$$$$$ REVERSE MARTINGALE
    // in case of loss, back to initial value 1
    // in case of winning, increase by one unit
    // in case of 4 consecutive wins, back to initial value 1
    
    if reversemartingale = 1 then
    ONCE n = levier
    IF Strategyprofit<Strategyprofit[1] THEN
    n = levier
    ENDIF
    IF Strategyprofit>Strategyprofit[1] THEN
    n = n + levier
    ENDIF
    IF n >= 6 * levier THEN // modifier la valeur selon vos préférences
    n = levier
    ENDIF
    endif
    
    //STRATEGY **************************************
    
    //
    if Cchoice = 1 or 3 then
    if close > Average[4800](close) then
    
    IF not longonmarket and Cbuy THEN
    BUY n CONTRACT AT MARKET
    ENDIF
    
    SET STOP pLOSS 5
    
    endif
    endif
    
    if Cchoice = 2 or 3 then
    if close < Average[4800](close) then
    
    IF not shortonmarket and Csell THEN
    sellshort n CONTRACT AT MARKET
    ENDIF
    
    SET STOP pLOSS 5
    endif
    endif
    
    //TRAILING STOP **************************************
    
    trailingstart = 15 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    Nicolas, ArnoldB, Paul and Kovit thanked this post
    Volatility_scalper_1S_v01.png Volatility_scalper_1S_v01.png
    #124484 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    For the moment, that doesn’t work with proorder..

    I have that systematically..

    Capture.png Capture.png
    #124486 quote
    MrCoolMrCool
    Participant
    Average

    Hi and thank you for your code!

    Really like the stratergy. I was trying to put it live on my demo but gets an error just after I start it? Have checked the code and the only thing I changed was the ploss to 6 because that’s the min stopploss? But also tried with higher without succes.

    #124487 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    Are you sure about the ploss set to 6 with IG account/DJI ?

    please note, the gain is more important.. 862$ for my sample..    it’s 1.6 for the spread between 1530 – 2200 with IG.

    In my example, i took 2 for the spread.

    But you are right…  i modified and try with different values for ploss and that the same thing..  bot rejected immediately

    #124489 quote
    MrCoolMrCool
    Participant
    Average

    When you try to start the bot this comes up (see picture)

    I got no near your gain with 1 contract with 100k units. (see picture of my backtest)

    For the spread normally its 1,6 but nowdays its going up and down like crazy.

    ploss.png ploss.png volscalp.png volscalp.png
    #124492 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    @MrCool

    It’s not DJI 1€ .. but DJI 2$ used.

    Capture-1.png Capture-1.png
    #124494 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    814$ with reversemartingale = 0

    838$ with reversemartingale = 1

    when this bot will work, be careful, please check this value because it’s not the value 1 which will be given to proorder but more if reversemartingale is on…  (position size is increased in this case)

    #124503 quote
    MrCoolMrCool
    Participant
    Average

    Ah my bad! Now I get the same results and it’s doing good today 🙂

    Yes I’m aware of that, thank you!

    Do you think its wrong with the code or ptr?

    #124517 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    I don’t know.. I open a ticket through held desk center of PRT

    i’m waiting and sure, i will come back soon 😉

    #124527 quote
    MrCoolMrCool
    Participant
    Average

    I don’t know.. I open a ticket through held desk center of PRT

    i’m waiting and sure, i will come back soon 😉

    I did the same 🙂

    #124758 quote
    NicolasNicolas
    Keymaster
    Legend

    Try to add a a defparam preloadbards = 1000 at the top of the code.

    You should also calculate your position size only before entering a new order, because now the “n” variable is calculating on each bar, even if you don’t meet the requirement to open a new position at market. So move the martingale code before line 79 and 91.

    #124780 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    @Nicolas

    you are right, but i just tested. as soon as i start prorder, the strategy is rejected…

    #124797 quote
    NicolasNicolas
    Keymaster
    Legend

    Sorry, I forgot a zero:

    defparam preloadbars = 10000
    #124798 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    thx Nicolas. It’s ok.

    #124802 quote
    fifi743fifi743
    Participant
    Master

    Good morning,
    The minimum stop this morning is 1095 point see attached picture

    GraHal thanked this post
    Capture-d’écran-1002.png Capture-d’écran-1002.png
Viewing 15 posts - 1 through 15 (of 49 total)
  • The topic ‘Volatility Scalper S1 V01’ is closed to new replies.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Volatility Scalper S1 V01


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
MAKSIDE @makside Participant
Summary

This topic contains 48 replies,
has 10 voices, and was last updated by robertogozzirobertogozzi
6 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/03/2020
Status: closed
Attachments: 16 files
ProRealCode ProRealCode
Loading...