ROBOT ADX

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #81325 quote
    Pablo Jimenez
    Participant
    Average

    Hello everyone, I am interested in making a robot with only one condition, I need  to open the operation at the close of the candle only if during the creation of the candle the ADX indicator has been in the range between 20 and 28. If it has been below or above I do not want to open the operation.
    It’s possible?
    Thank you

    #81345 quote
    robertogozzi
    Moderator
    Master

    Please update your country flag.

    DO NOT post multiple times about the same topics!

    DO NOT post using different languages from that of the forum!

    Use the correct forum, this is strategy, not an indicator, so I will move it to the ProOrder support.

    Thank you and welcome aboard!

    #81348 quote
    robertogozzi
    Moderator
    Master

    You will have to use MTF (Multiple Time Frame) to achieve that, with your favourite TF set to DEFAULT behaviour (rather than UPDATEONCLOSE), then use a much lower TF to scan the forming higher candle as many times as possible:

    TIMEFRAME (4 hours,default)
    MyAdx = ADX[14]
    
    TIMEFRAME (default)
    ONCE ValidAdx = 1
    IF MyAdx < 20 OR MyAdx > 28 THEN
       ValidAdx = 0
    ENDIF

    launch it from a 1-minute chart, of course you will have to reset VALIDADX whenever you want, but that’s beyond your question.

    Nicolas thanked this post
    #81420 quote
    Pablo Jimenez
    Participant
    Average

    Buenos dias, estoy intentando hacer un robot que estoy haciendo basándome en las siguientes condiciones:

    Entradas para largos: Deben cumplirse todas y cada una de las condiciones, siempre operamos al cierre de vela.

    1° El precio debe estar por encima de la EMA 8 (La vela debe haber cerrado por encima de ella).
    2° El precio debe estar por encima de la Media Alisada de Wilder de 8 periodos.
    3° El williams de 40 periodos debe estar por encima del valor -50.
    4° Debe haber habido 2 cierres de vela anteriores por encima de la EMA 8.
    5° La vela donde nos ha dado la entrada debe haber hecho un máximo mayor que el máximo de la vela justamente precedente.
    6° Para que nos de entrada el adx durante dicha vela ha tenido que estar comprendido entre 17 y 28, (17 <=adx<= 28), es decir si durante el proceso de creación de la vela el valor de adx ha sido mayor o igual a 17 o menor o igual 28 y ademas se cumplen todas las anteriores condiciones, entonces abriríamos operación.

    Para las condiciones de entrada en corto serian las mismas condiciones para el adx simplemente k las demás condiciones serian al contrario ( willy<-50, precio por debajo de la ema8, de la media alisada, 2 mínimos… etc).

    Para el cierre de la operación he propuesto 2 sistemas:

    – Un stop de seguridad en x puntos.
    – En el momento en el que el precio toque la media alisada de Wilder, es decir cuando el precio= media alisada de Wilder de 8 periodos, no tenemos porque esperar cierre de vela. En el momento que haga una mecha y toque la media la operación debe cerrarse.

    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada
    
    // Condiciones para entrada de posiciones largas
    indicator1 = ExponentialAverage[8](close)
    c1 = (indicator1 < close)
    indicator2 = Williams[40](close)
    c2 = (indicator2 > -50)
    indicator3 = WilderAverage[8](close)
    c3 = (indicator3 < close)
    indicador4 = ADX[14]
    c4= (indicador4 >= 17 OR indicador4 <= 28)
    
    
    IF c1 AND c2 AND c3  and c4 THEN
    BUY 5 CONTRACT AT MARKET
    ENDIF
    
    // Condiciones de salida de posiciones largas
    indicator5 = WilderAverage[8](close)
    c5 = (indicator5 = close)
    
    IF c5 THEN
    SELL AT MARKET
    ENDIF
    
    // Stops y objetivos
    SET STOP pLOSS 100

     

    El codigo lo tengo comenzado pero no consigo implementar la condicion del ADX y estoy bloqueado, alguien podría ayudarme? Muchas gracias

    #81422 quote
    Nicolas
    Keymaster
    Master

    Hey Pablo, please post your message in English in an English topic! Thank you.

    #81423 quote
    GraHal
    Participant
    Master

    Isn’t this the Issue (mutually exclusive?) …

    indicador4 = ADX[14]
    c4= (indicador4 >= 17 OR indicador4 <= 28)

    You need

    indicador4 = ADX[14]
    c4= (indicador4 >= 17 AND indicador4 <= 28)
    robertogozzi thanked this post
    #81426 quote
    Pablo Jimenez
    Participant
    Average

    Good morning, I am trying to make a robot that I am doing based on the following conditions:

    Long conditions: All the conditions must be fulfilled, we must open the position at the close of the candle.

    1 ° The price must be above the EMA 8 (The candle must have closed above it).
    2 ° The price must be above Wilder’s Smoothed Average of 8 periods.
    3 ° The Williams of 40 periods must be above the value -50.
    4 ° There must have been 2 previous candles closures above the EMA 8.
    5 ° The candle where the entrance has given us must have made a maximum higher than the maximum of the just preceding candle.
    6 °  To enter the adx during said candle has had to be between 17 and 28, (17 <= adx <= 28), that is if during the process of creating the candle the value of adx has been higher or equal to 17 or less or equal 28 and also all the above conditions are met, then we would open operation.

    For short entry conditions would be the same conditions for the adx but

    // Definición de los parámetros del código
    DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada
     
    // Condiciones para entrada de posiciones largas
    indicator1 = ExponentialAverage[8](close)
    c1 = (indicator1 < close)
    indicator2 = Williams[40](close)
    c2 = (indicator2 > -50)
    indicator3 = WilderAverage[8](close)
    c3 = (indicator3 < close)
    indicador4 = ADX[14]
    c4= (indicador4 >= 17 OR indicador4 <= 28)
     
     
    IF c1 AND c2 AND c3  and c4 THEN
    BUY 5 CONTRACT AT MARKET
    ENDIF
     
    // Condiciones de salida de posiciones largas
    indicator5 = WilderAverage[8](close)
    c5 = (indicator5 = close)
     
    IF c5 THEN
    SELL AT MARKET
    ENDIF
     
    // Stops y objetivos
    SET STOP pLOSS 100

     

    the other conditions would be the opposite (willy <-50, price below the ema8, the smoothed average, 2 minima … etc).

    For the closing of the operation I have proposed 2 systems:

    – A security stop at x points.
    – At the moment in which the price touches Wilder’s smoothed average, that is to say when the price = Wilder’s smoothed average of 8 periods, we do not have to wait for sail closing. The moment you make a wick and touch the stock, the operation should be closed.

    #81427 quote
    Pablo Jimenez
    Participant
    Average

    It doesn’t work

    #81438 quote
    robertogozzi
    Moderator
    Master

    Try following GraHal‘s suggestion.

    #81439 quote
    GraHal
    Participant
    Master

    It doesn’t work

    When you say it doesn’t work, do you mean it doesnt run or it doesn’t make the profit you would like? 🙂

    It does run see attached results from your code.

    ADX in the range between 20 and 28. If it has been below or above I do not want to open the operation.

    So you need AND as below (not OR as you show in your code at Line 12).

    indicador4 = ADX[14]
    c4= (indicador4 >= 17 AND indicador4 <= 28)
    Pablo-1.jpg Pablo-1.jpg
    #81441 quote
    Pablo Jimenez
    Participant
    Average

    When I do the test, its looks like that…..

    DOW.png DOW.png
    #81444 quote
    Pablo Jimenez
    Participant
    Average

    I have tried the  GraHal‘s suggestion but it doesn’t work. I don’t know why…

    #81446 quote
    robertogozzi
    Moderator
    Master

    You did not add the code to meet your condition 4 (2 previous candles above Ema 8):

    c6 = (summation[2](c1[1]) = 2)

    You also did not add the code to meet your condition 5 (higher high):

    c7 = high > high[1]

    then you can follow GraHal‘s suggetion and be winning!

    Of course you’ll have to add C6 abd C7 to conditions to enter long (line 15).

     

    #81447 quote
    Pablo Jimenez
    Participant
    Average

    Grazie mille Roberto but the robot doesn’t make any operation, I have changed the code with yours suggestions.

    PRUEBA.png PRUEBA.png
    #81459 quote
    robertogozzi
    Moderator
    Master

    I think your strategy HAS entered one trade AND it is still OPEN, after more than one year!

    Click on the TAB “Liste des Ordres”.

    It’s because condition C5 will NEVER be true, how can a price (close) be EQUYAL to a MA? You should use “>=”, instead  in line 21 and you’ll have LOTS of trades!

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

ROBOT ADX


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 18 replies,
has 4 voices, and was last updated by Pablo Jimenez
7 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/26/2018
Status: Active
Attachments: 8 files
Logo Logo
Loading...