Scalping EURUSD

Viewing 15 posts - 16 through 30 (of 33 total)
  • Author
    Posts
  • #33439 quote
    Elsborgtrading
    Participant
    Veteran

    Hi Maz, yes you are right, it’s in yen. I think it has something to do with the ploss stoploss 70.. I have before experianced that the pipsize or pointvalue has sometimes an odd way in yen- even though it shouldn’t matter. I will take a look later.

    Cheers Kasper

    #33442 quote
    victormork
    Participant
    Veteran

    First, cheers to all of you who have paid interest in my topic!

    And thanks a lot Maz for helping me out with turning my beginner coding into something more functional!! I’ll have a look at the changes made and try to play around with it 🙂

    I’m sorry Kasper but I have no clue what could be wrong. Luckily I think you got some suggested from Maz with regards to what might be wrong.

    #33443 quote
    victormork
    Participant
    Veteran

    @ Kasper on the new version from Maz you need to change the value on stoplossmode which is currently 2.

    stopLossMode  = 2          // 1: Static | 2: Dynamic

    I got the same result at you first but when I changed to a higher value I got a positiv result.

    #33444 quote
    victormork
    Participant
    Veteran

    Correction -> Try the static stop (1) instead of the dynamic

    Elsborgtrading thanked this post
    #33490 quote
    victormork
    Participant
    Veteran

    Here are the results with different kind of stops. I couldn’t get any nice result from an ATR stop. I still haven’t tried a time stop.

    1.-static-stop.png 1.-static-stop.png 3.-trailing-stop-1.png 3.-trailing-stop-1.png 4.-trailing-stop-2.png 4.-trailing-stop-2.png ADX-Bol-MR-USDJPY.itf
    #33535 quote
    Maz
    Participant
    Veteran

    For the ATR stop try:

    SET STOP pLOSS (atr * slATRmultiple) * pointSize

    ??

    #33538 quote
    Elsborgtrading
    Participant
    Veteran
    SET STOP pLOSS (atr * slATRmultiple) /pointsize

    Now it works 🙂

    victormork thanked this post
    #34492 quote
    victormork
    Participant
    Veteran

    This is the updated version for EURUSD 5M

    Defparam Cumulateorders = false
    Defparam Preloadbars = 300
    
    //------ Trading hours-------
    Starttime = 100000
    Endtime = 240000
    fridayEndTime = 225000
    
    // --------Indicators------
    blow = Bollingerdown[20]
    bhigh = Bollingerup[20]
    MA1 = Average[8]
    MA2 = Average[200]
    ad = adx[24]
    adlevel = 14
    atr   = averageTrueRange[40]
    slATRmultiple = 5
    targetATRmultiple = 3
    stopLossMode  = 1          // 1: Static | 2: Dynamic | 3: DONCHIAN STOP
    DC = 20
    strailing = 1 // 0=off 1=on
    strailingstart = 20
    isLateFriday  = (dayOfWeek = 5 and time >= fridayEndTime)
    
    // ------ ENTRY CONDITIONS LONG-----
    cb1 = (low < blow and close < blow)
    cb2 = (MA1 > MA2)
    cb3 = (currenttime > Starttime  and currenttime < Endtime)
    cb4 = (ad > adlevel)
    c5 = cb1 and cb2 and cb3 and cb4
    IF NOT Longonmarket and c5  THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // ------ EXIT CONDITIONS LONG-----
    cb9 = LONGONMARKET AND ((close > bhigh) OR isLateFriday)
    
    IF cb9 Then
    sell at market
    endif
    
    // ------ ENTRY CONDITIONS SHORT-----
    cs1 = (high > bhigh and close > bhigh)
    cs2 = (MA1 < MA2)
    cs3 = (currenttime > Starttime  and currenttime < Endtime)
    cs4 = (ad > adlevel)
    cs6 = cs1 and cs2 and cs3 and cs4
    
    IF NOT Shortonmarket and cs6 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // ------ ENTRY CONDITIONS SHORT----
    cs9 = SHORTONMARKET AND ((close < blow) OR isLateFriday)
    
    IF cs9 Then
    Exitshort at market
    endif
    
    //------ STOP AND TARGETS -----------
    if stopLossMode = 1 then
    SET STOP pLOSS 65
    //SET TARGET pPROFIT 30
    
    elsif stopLossMode = 2 then
    SET STOP pLOSS (atr * slATRmultiple)/pointsize
    SET TARGET pPROFIT (atr * targetATRmultiple)/pointsize
    
    
    elsif stopLossMode = 3 then
    e= Highest[DC](high)
    f=Lowest[DC](low)
    if longonmarket  then
    laststop = f[1]
    endif
    if shortonmarket  then
    laststop = e[1]
    endif
    if onmarket then
    sell at laststop stop
    exitshort at laststop stop
    endif
    endif
    
    if strailing = 1 then
    //trailing stop
    trailingstop = strailingstart
    
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    priceexit = 0
    endif
    
    //case SHORT order
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
    
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
    
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    endif
    endif
    
    
    
            
    Francesco78 and AlgoAlex thanked this post
    #34500 quote
    Maz
    Participant
    Veteran

    Cool. Just a thought – have you tried using combinations stop modes together? For example rather than selection stop mode 1, 2 or 3; being able to switch 1, 2 and 3 on and off separately?

    #34501 quote
    GraHal
    Participant
    Master

    Very useful Maz the timezone offset variable

    It may be less confusing for everyone if the timezone offset variable is labelled and set at the World Universal Time which is called UTC.  (UK is not at GMT in the Summer, but is at BST or GMT+1).

    UTC overcomes confusion as it is the accepted World Standard … a Universal Time Clock.

    UK is UTC+1

    Kasper is UTC+2

    Just a suggestion for improvement, but credit goes to you Maz for a great idea … hope others follow your lead.

    GraHal

    Maz thanked this post
    #34503 quote
    Maz
    Participant
    Veteran

    Good point @GraHal. A shared UTC offset snippet that can be plugged into anyone’s code would be useful.

    #34505 quote
    victormork
    Participant
    Veteran

    sorry guys but I skipped adding the time zon for EURUSD but it’s more or less a copy past form the USDJPY.

    @Maz – do you mean for example having a fixed target combined with an dynamic stop? That I’ve not yet tried.

    #34924 quote
    Maz
    Participant
    Veteran

    Yes, that’s what I was referring to.

    #35029 quote
    victormork
    Participant
    Veteran

    Thanks for the idea Maz.

    I tried the ATR based target to the trailing stop function which showed the best result and it did improve the return. I also tried the an ATR based starting point for the trailing stop but it left the return, win-rate etc unchanged. I’ve attached the latest code.

    GraHal and Francesco78 thanked this post
    Boll-meanrev.-USDJPY-5M.itf
    #35961 quote
    victormork
    Participant
    Veteran

    I tired to make a small monte carlo on the long side for USDJPY and the result looks like attached file.

    Francesco78 and Maz thanked this post
    Skärmavbild-2017-05-18-kl.-11.25.16.png Skärmavbild-2017-05-18-kl.-11.25.16.png
Viewing 15 posts - 16 through 30 (of 33 total)
  • You must be logged in to reply to this topic.

Scalping EURUSD


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
victormork @victormork Participant
Summary

This topic contains 32 replies,
has 7 voices, and was last updated by Ronny
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/11/2017
Status: Active
Attachments: 15 files
Logo Logo
Loading...