traducir experto metastock "PS Fractal Trading System 1" a PRT

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #113920 quote
    dax821
    Participant
    Junior

    Buenas tardes

    Quisiera, por favor, ayuda para traducir este experto de la plataforma metastock  “PS Fractal Trading System 1”

    Performance Systems
    Fractal Trading System 1
    Trading signals for <Name> (<Symbol>) on <Date>
    WriteIf(F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));F2:=ValueWhen(1,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));a:=Cross(H,F1);b:=Cross(F2,L);
    state:=If(BarsSince(a)<BarsSince(b),1,0);
    state>Ref(state,-1),”If trading short positions, exit all short positions today with a Market On Close (MOC) order or at the market price on tomorrow’s open.
    If trading long positions, enter long today with a Market On Close (MOC) order or at the market price on tomorrow’s open. “)\
    \
    WriteIf(F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));F2:=ValueWhen(1,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));a:=Cross(H,F1);b:=Cross(F2,L);
    state:=If(BarsSince(a)<BarsSince(b),1,0);
    state<Ref(state,-1),”If trading long positions, exit all long positions today with a Market On Close (MOC) order or at the market price on tomorrow’s open.
    If trading short positions, enter short today with a Market On Close (MOC) order or at the market price on tomorrow’s open. “)\
    \
    WriteIf(F1:=ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));F2:=ValueWhen(1,L>Ref(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2),Ref(L,-2));a:=Cross(H,F1);b:=Cross(F2,L);
    state:=If(BarsSince(a)<BarsSince(b),1,0);
    state=Ref(state,-1),”No trading signals today.”)
    While there are many definitions for a fractal in securities trading, the definition used in these systems is a minor version of the type defined by Bill Williams, Ph.D., and his chaos-based trading methods. According to Bill Williams, an “up fractal” is defined as a middle bar with two lower highs on each side of it. A “down fractal” would be the reverse being a middle bar with two higher lows on each side of it.
    This system is based on a very small fraction of Bill Williams’ complete trading system.
    The system enters a long position when a price crosses above the most recent up fractal. The position would be exited and a short position entered when the price crosses below the most recent down fractal.
    muchas gracias
    fractal.txt
    #114056 quote
    dax821
    Participant
    Junior
    //—– Highs —–
    ONCE HighCount = Undefined
    ONCE HighFractal = Undefined
    
    IF (High > High[1]) AND (High > High[2]) THEN
    HighLevel = High
    ENDIF
    IF (High < HighLevel) THEN
    HighCount = HighCount – 1
    ELSIF (High >= HighLevel) THEN
    HighCount = 0
    ENDIF
    IF HighCount = -2 THEN
    HighFractal = HighLevel
    ELSE
    HighFractal = HighFractal
    ENDIF
    if   high crosses over Highfractal   then
    DRAWARROWUP(barindex, high +0.0001)coloured(0,255,0)
    endif
    
    //—– Lows —–
    ONCE LowCount = Undefined
    ONCE LowFractal = Undefined
    IF (Low < Low[1]) AND (Low < Low[2]) THEN
    LowLevel = Low
    ENDIF
    IF (Low > LowLevel) THEN
    LowCount = LowCount + 1
    ELSIF (Low <= LowLevel) THEN
    LowCount = 0
    ENDIF
    IF LowCount = 2 THEN
    LowFractal = LowLevel
    ELSE
    LowFractal = LowFractal
    ENDIF
    if   LOW crosses UNDER LOWfractal   then
    DRAWARROWDOWN(barindex, low -0.0001)coloured(255,10,10)
    endif
    RETURN HighFractal as “High Level”, LowFractal as “Low Level”
    buenos días
    Esto es hasta donde he podido llegar, necesitaría por favor, terminar con la traducción. Faltaría terminar esto
    El sistema entra en una posición larga cuando un precio cruza por encima del fractal ascendente <<<más reciente>>>. Se saldría de la posición y se ingresaría una posición corta cuando el precio cruza por debajo del fractal descendente >>>> más reciente<<<<.
    muchas gracias
    #114066 quote
    robertogozzi
    Moderator
    Master

    >> Para claridad de los mensajes en los foros de ProRealCode, por favor utilice el botón “insert code PRT” para separar el texto de la parte de código! ¡Gracias! << 🙂

    #114070 quote
    Nicolas
    Keymaster
    Master

    Con este código, la orden de compra estará abierta solo si el último fractal fue uno superior y viceversa para la orden de venta:

    defparam cumulateorders=false
    
    //—- Highs —-
    ONCE HighCount = Undefined
    ONCE HighFractal = Undefined
    
    IF (High > High[1]) AND (High > High[2]) THEN
    HighLevel = High
    ENDIF
    IF (High < HighLevel) THEN
    HighCount = HighCount - 1
    ELSIF (High >= HighLevel) THEN
    HighCount = 0
    ENDIF
    IF HighCount = -2 THEN
    HighFractal = HighLevel
    highfractalbar=barindex
    ELSE
    HighFractal = HighFractal
    ENDIF
    if   high crosses over Highfractal and highfractalbar>lowfractalbar   then
    //DRAWARROWUP(barindex, high +0.0001)coloured(0,255,0)
    buy 1 contract at market 
    endif
    
    //—- Lows —-
    ONCE LowCount = Undefined
    ONCE LowFractal = Undefined
    IF (Low < Low[1]) AND (Low < Low[2]) THEN
    LowLevel = Low
    ENDIF
    IF (Low > LowLevel) THEN
    LowCount = LowCount + 1
    ELSIF (Low <= LowLevel) THEN
    LowCount = 0
    ENDIF
    IF LowCount = 2 THEN
    LowFractal = LowLevel
    lowfractalbar=barindex
    ELSE
    LowFractal = LowFractal
    ENDIF
    if   LOW crosses UNDER LOWfractal and lowfractalbar>highfractalbar  then
    //DRAWARROWDOWN(barindex, low -0.0001)coloured(255,10,10)
    sellshort 1 contract at market 
    endif
    
    #114139 quote
    dax821
    Participant
    Junior

    Muchas gracias por su respuesta. Intentaré probar la programación.

    saludos

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

traducir experto metastock "PS Fractal Trading System 1" a PRT


ProOrder: Trading Automático y Backtesting

New Reply
Author
author-avatar
dax821 @dax821 Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by dax821
6 years, 3 months ago.

Topic Details
Forum: ProOrder: Trading Automático y Backtesting
Language: Spanish
Started: 11/29/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...