A little help for this strategy that works very well …

Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • #26196 quote
    ParisParis
    Participant
    Veteran

    hi all

    i have this code that works very well but i don’t like the system of accumulation

    //-------------------------------------------------------------------------
    // Code principal : MonSystème(196)
    //-------------------------------------------------------------------------
    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
    
    DEFPARAM FlatAfter =173000
    
    capital=strategyprofit+10000
    n=capital/1000
    
    if n>100 then
    n=100
    endif
    if n<10 then
    n=10
    endif
    
    HoraEntradaLimite = 090600
    HoraInicio = 090500
    
    HoraEntradaLimite1 = 091600
    HoraInicio1 = 091500
    
    HoraEntradaLimite2 = 093100
    HoraInicio2 = 093000
    
    if dayofweek=1 then //Monday
    daytrading=1
    endif
    if dayofweek=2 then // Tuesday
    daytrading=1
    endif
    if dayofweek=3 then // Wednesday
    daytrading=1
    endif
    if dayofweek=4 then //Thursday
    daytrading=1
    endif
    if dayofweek=5 then // Frifay
    daytrading=1
    endif
    
    
    if Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1  or Time >= HoraInicio1 and time <= HoraEntradaLimite1 and daytrading= 1  or Time >= HoraInicio2 and time <= HoraEntradaLimite2 and daytrading= 1  then
    
    
    c1 = open < close-2
    if not onmarket then
    IF c1 THEN
    
    buy n contract AT close+2 stop
    endif
    
    c2= open > close-1
    
    IF c2 THEN
    
    sellshort n contract AT close-1 stop
    endif
    endif
    endif
    
    
    
    
    SET STOP ptrailing 5
    
    #26197 quote
    ParisParis
    Participant
    Veteran

    i would like to put in the accumulation of  this system , i ve tried to code it  but it seems to not work…. it give no results

     

    //-------------------------------------------------------------------------
    // Code principal : MonSystème(197)
    //-------------------------------------------------------------------------
    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = false // Acumulación de posiciones desactivada
    
    // La posición se cierra a las 17:29 p.m. si no toca ni stop ni take.
    DEFPARAM FlatAfter =173000
    
    once ordersize=1
    // No se abren nuevas posiciones después de la vela que se cierra a las 09:06
    HoraEntradaLimite = 090600
    // El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05
    HoraInicio = 090500
    
    // Órdenes máximas
    if Ordersize>18 then
    Ordersize=18
    endif
    
    // Riesgo, multiplicador de contratos.
    
    n=6
    
    // Condiciones para el analisis.
    
    if Time >= HoraInicio and time <= HoraEntradaLimite then
    
    // Condiciones de entrada de posiciones largas.
    
    c1 = open < close-1
    IF c1 THEN
    IF PositionPerf(1) < 0 THEN
    OrderSize = OrderSize/2//+1
    if ordersize<1 then
    ordersize=1
    ENDIF
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize =OrderSize+2
    endif
    // Si la primera barra del día de 5 min es positiva, compramos.
    buy ordersize*n shares at market
    endif
    
    // Condiciones de entrada de posiciones cortas.
    
    c2= open > close-1
    IF c2 THEN
    iF PositionPerf(1) < 0 THEN
    OrderSize = OrderSize/2//+1
    if ordersize<1 then
    ordersize=1
    ENDIF
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize =OrderSize+2
    ENDIF
    // Si la primera barra del día de 5 min es negativa, vendemos.
    sellshort ordersize*n shares at market
    endif
    endif
    
    SET STOP ploss 5
    SET TARGET pPROFIT 10
    
    
    
    #26199 quote
    ParisParis
    Participant
    Veteran

    any one for help me …

    #26205 quote
    ParisParis
    Participant
    Veteran

    results for the first  system very nice

    Capture-du-2017-02-23-17-57-55.png Capture-du-2017-02-23-17-57-55.png
    #26208 quote
    ParisParis
    Participant
    Veteran
    #26230 quote
    DerekDerek
    Participant
    Veteran

    Hello Paris,

    maybe like this?

    DEFPARAM CumulateOrders = true 
    DEFPARAM FlatAfter =173000
    
    once ordersize=1
    
    // Órdenes máximas
    if Ordersize>18 then
    Ordersize=18
    endif
    
    // Riesgo, multiplicador de contratos.
    
    n=6
    
    HoraEntradaLimite = 090600
    HoraInicio = 090500
    
    HoraEntradaLimite1 = 091600
    HoraInicio1 = 091500
    
    HoraEntradaLimite2 = 093100
    HoraInicio2 = 093000
    
    if dayofweek=1 then //Monday
    daytrading=1
    endif
    if dayofweek=2 then // Tuesday
    daytrading=1
    endif
    if dayofweek=3 then // Wednesday
    daytrading=1
    endif
    if dayofweek=4 then //Thursday
    daytrading=1
    endif
    if dayofweek=5 then // Frifay
    daytrading=1
    endif
    
    
    if Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1  or Time >= HoraInicio1 and time <= HoraEntradaLimite1 and daytrading= 1  or Time >= HoraInicio2 and time <= HoraEntradaLimite2 and daytrading= 1  then
    
    
    c1 = open < close-2
    if not onmarket then
    IF c1 THEN
    IF PositionPerf(1) < 0 THEN
    OrderSize = OrderSize/2//+1
    if ordersize<1 then
    ordersize=1
    ENDIF
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize =OrderSize+2
    endif
    buy ordersize*n contract AT close+2 stop
    endif
    
    c2= open > close-1
    
    IF c2 THEN
    iF PositionPerf(1) < 0 THEN
    OrderSize = OrderSize/2//+1
    if ordersize<1 then
    ordersize=1
    ENDIF
    ELSIF PositionPerf(1) > 0 THEN
    OrderSize =OrderSize+2
    ENDIF
    sellshort ordersize*n contract AT close-1 stop
    endif
    endif
    endif
    
    SET STOP ptrailing 5
    #26233 quote
    ParisParis
    Participant
    Veteran

    just before to go beyond   of course these two codes are from raul .

    #26236 quote
    ParisParis
    Participant
    Veteran

    ok thanks derek thanks  for your code , it works perfectly , i put it on my collection .

     

    but it is not exctly what i wanted to do .

    The basis of the new strategy is the first code , so it only go long no shorts  , and i want to replace in it , the accumulation , wich is in the second code

     

    once ordersize=1
    // No se abren nuevas posiciones después de la vela que se cierra a las 09:06
    HoraEntradaLimite = 090600
    // El análisis de mercado empieza en la vela de 5 minutos que cierra a las 09:05
    HoraInicio = 090500
    
    // Órdenes máximas
    if Ordersize>18 then
    Ordersize=18
    endif
    
    // Riesgo, multiplicador de contratos.
    
    n=6
    
    // Condiciones para el analisis.
    
    
    #26237 quote
    ParisParis
    Participant
    Veteran

    in the first code i want to ” gear ” the orders , by now it always send 10 contracts  and i dont like that .

    #26241 quote
    GraHalGraHal
    Participant
    Master

    @Paris Your first code states below so it will trade 10. But I’m sure you can see that so I must be confused what you are saying?

    if n<10 then
    n=10
    endif<br><br>
    
    buy n contract AT close+2 stop
    endif
    #26245 quote
    DerekDerek
    Participant
    Veteran

    Hello Paris,

    this was just a copy & paste of the position sizing from system 2 into system 1 and, I admit, I did not run the code myself.

    #26246 quote
    ParisParis
    Participant
    Veteran

    yes i understand  why it only  trade 10 , but i want that trades like  the second ….

    for example :

    c1 = open < close-2
    if not onmarket then
    IF c1 THEN
    
    buy n*ordersize contract AT close+2 stop
    endif
    
    c2= open > close-1
    
    IF c2 THEN
    
    sellshort n*ordersize contract AT close-1 stop 
    endif 
    endif
     endif
    
    
    
            
            
        
    #26247 quote
    GraHalGraHal
    Participant
    Master

    @Paris You say you want to gear the orders … is below of any help?

    https://www.prorealcode.com/topic/grid-orders-with-one-combined-stop-loss-and-limit-can-it-be-done/

    #26249 quote
    DerekDerek
    Participant
    Veteran

    By the way: Both systems you posted go short.

    #26250 quote
    ParisParis
    Participant
    Veteran

    @ grahal   ,  no ….  more like the way that raul do it , in second code

     

    @ derek , you are right  ,my mistake sorry ….   ” sellshort ” is a short order , i was thnking of just ” sell “

Viewing 15 posts - 1 through 15 (of 25 total)
  • You must be logged in to reply to this topic.
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

A little help for this strategy that works very well …


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paris @ladefense Participant
Summary

This topic contains 24 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/23/2017
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...