Entrare con condizioni proveniente da diversi timeframe

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #203519 quote
    MattiaMattia
    Participant
    New

    Qualcuno sa come fare un sistema che se l’heikin ashi del 4 ore è verde, nel grafico 5min compra ogni volta che l’ema 20 incrocia al rialzo la ema 50 e chiude la posizione quando incrocia al ribasso.
    Se l’heikin ashi del 4 ore è rosso, nel grafico 5min vende ogni volta che l’ema 20 incrocia al ribasso le ema 50 e chiude la posizione quando incrocia al rialzo

    #203541 quote
    MauroProMauroPro
    Participant
    Veteran

    Prova questo dovrebbe andare:

     

    defParam cumulateOrders = false

    timeframe (4 Hours, updateOnClose)
    xOpenH4 = open
    xCloseH4 = (open + close + high + low) / 4
    if barindex > 0 then
    xOpenH4 = (xOpenH4[1] + xCloseH4[1]) / 2
    endif
    xLowH4 = min(low,min(xCloseH4,xOpenH4))
    xHighH4 = max(high,max(xCloseH4,xOpenH4))
    candelaVerdeH4 = xCloseH4 > xOpenH4
    candelaRossaH4 = xCloseH4 < xOpenH4
    //———————————————————————–
    timeframe (5 minutes, updateOnClose)
    xOpen = open
    xClose = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen = (xOpen[1] + xClose[1]) / 2
    endif
    xLow = min(low,min(xClose,xOpen))
    xHigh = max(high,max(xClose,xOpen))
    candelaVerde = xClose > xOpen
    candelaRossa = xClose < xOpen
    ema20 = average[20,1](xClose)
    ema50 = average[50,1](xCLose)
    //————————————————-
    entrataLong = ema20 crosses over ema50
    uscitaLong = ema20 crosses under ema50
    entrataShort = ema20 crosses under ema50
    uscitaShort = ema20 crosses over ema50
    //——————————————————–
    if not onMarket and candelaVerdeH4 and entrataLong then
    buy 1 contract at market
    endif
    if longOnMarket and uscitaLong then
    sell 1 contract at market
    endif

    if not onMarket and candelaRossaH4 and entrataShort then
    sellShort 1 contract at market
    endif

    if shortOnMarket and uscitaShort then
    exitShort 1 contract at market
    endif

    #203545 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    @Mattia

    ho notato che hai aperto 3 topic identici, uno è questo,  gli altri due sul forum errato (ProBuilder), di cui uno in lingua inglese.
    Ho cancellato gli altri due.
    Ti prego di non duplicare i post e di usare un’unica lingua, una volta selezionata quella preferita. Post doppi o in lingue diverse rischiano di disperdere le informazioni, rendendone più difficile la ricerca.
    Grazie 🙂
    #203556 quote
    MattiaMattia
    Participant
    New

    Grazie mille Mauro!!!

Viewing 4 posts - 1 through 4 (of 4 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

Entrare con condizioni proveniente da diversi timeframe


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Mattia @mattia Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by MattiaMattia
3 years, 10 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 11/04/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...