Indicatore non funziona in “CALL”
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Indicatore non funziona in “CALL”
- This topic has 8 replies, 4 voices, and was last updated 29 minutes ago by
robertogozzi.
-
-
07/28/2025 at 12:16 PM #249154
Buongiorno,
il mi primo indicatore, che calcola l’ATR daily quando ci si trova in un TF intraday, funziona quando è applicato
a un grafico, ma non se è chiamato da un altri indicatore (ritorna e stampa N/D), anche la semplice chiamata;
MyATR= CALL RdAATRDInIntraday [5]
returnDi seguito il codice dell’indicatore. In allegato il grafico dove si vede il valore calcolato.
Se un altro indicatore lo chiama, al posto del valore corretto restiuisce e stampa N/D
Grazie
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869// R. da Argile//// Compute TR daily in TF intraday// A MINIMUM NUMBER OF BARS MAY BE REQUIRED TO BE ACCURATE//// DEFPARAM DRAWONLASTBARONLY = true // for debug purposeTFDailyInSeconds = 3600 * 24 // various intraday time frames in secondsTFMinInSeconds = 60 // ...TF30MinInSeconds = 60 * 30 // ...TFWeeklyInSeconds = 3600 * 24 * 7 // ...TFMaxIntradayInSeconds = 3600 * 4 // max intraday considered is 4HONCE AlreadyDrawnInfo = 0ONCE AlreadyComputedTodayNumOfMBbars = 0// get and shows current TFIF AlreadyDrawnInfo = 0 THEN // Stuff to be done only ONCETF = GetTimeFrame // timeframe in secondsTFinMin = TF / 60//DRAWTEXT ("timeframe in seconds #TF# ", -100, -50) ANCHOR (TOPRIGHT, XSHIFT, YSHIFT)TFintraday = 1TFNumBarsInDay = 3600 / TFIF TF > TFMaxIntradayInSeconds THEN // Computatin only TF intraday up to 4HTFintraday = 0TFNumBarsInDay = 1ENDIF//AlreadyDrawnInfo = 1ENDIF//// compute running ATR daiy//CurrentTRDaily = max(DHIGH(0) - DLOW(0), MAX(abs(DHIGH(0) - DCLOSE(1)), abs(DLOW(0) - DCLOSE(1))))// Get last day before yesterday barIF BarIndex < (ATRdailyPeriod * TFNumBarsInDay) THENPreviousDayClose = DCLOSE(2) // previous day closePreviousDayLow = DLOW(2) // previous day lowCurrentTRDaily = MAX(DHIGH(1)-DLOW(1), MAX(abs(DHIGH(1) - PreviousDayClose), ABS(DLOW(1) - PreviousDayClose))) // current True Range DailyMyATRDaily = CurrentTRDailyELSEIF INTRADAYBARINDEX = 0 THEN // compute new atr daily only on first intraday barBarFDound = 0iBar = 0WHILE (BarFDound < 2) AND (iBar < (2 * TFNumBarsInDay)) // secon check is to avoid infiniteloopIF OPENDAYOFWEEK[iBar] <> OPENDAYOFWEEK[iBar + 1] THENiLastYesterdayBar = iBar + 1BarFound = BarFound + 1ENDIFiBar = iBar + 1WENDPreviousDayClose = DCLOSE(iLastYesterdayBar+1) // previous day closePreviousDayLow = DLOW(iLastYesterdayBar+1) // previous day lowCurrentTRDaily = MAX(DHIGH(iLastYesterdayBar)-DLOW(iLastYesterdayBar), MAX(abs(DHIGH(iLastYesterdayBar) - PreviousDayClose), ABS(DLOW(iLastYesterdayBar) - PreviousDayClose))) // current True Range DailyMyATRDaily = ((MyATRDaily[1] * (ATRdailyPeriod - 1)) + CurrentTRDaily) / ATRdailyPeriodELSEMyATRDaily = MyATRDaily[1]ENDIFENDIFIF DATE = TODAY THENDRAWTEXT ("ATRD computed in TF <#TFinMin#Min>: #MyATRDaily# ", -100, -35) ANCHOR (TOPRIGHT, XSHIFT, YSHIFT)ENDIF// return al least 2 values otherwise indicator takes the name of the UNIQUE return value (sic!)RETURN myATRdaily AS "ARdaily" COLOURED (0,0,0,0)07/28/2025 at 1:33 PM #249160Comunque ho inserito il codice con il pulsante ma vedo che non lo ha indentato ….
07/28/2025 at 3:49 PM #249164Non lo indenta.
Posta il file ITF, oppure indica qual’è il dato che gli viene passato con la CALL.
07/28/2025 at 3:58 PM #249167PRT non consente la CALL di un indicatore contenente codice MultiTimeFrame (MTF). Sfortunatamente PRT non ti dà un messaggio di errore decente se provi questo. La mia ipotesi è che il colpevole sia il tuo gettimeframe nella riga 19. (autotranslate par DEEPL)
07/28/2025 at 4:16 PM #249170Forse si tratta di qualcosa nel tuo codice…
nel grafico seguente puoi vedere l’ATR calcolato direttamente nell’indicatore e richiamato con l’istruzione CALL.123timeframe(daily)myATRdaily=averagetruerange[5](close)RETURN myATRdaily12myatr=call "MyIndicator(5)"return myatr1 user thanked author for this post.
07/28/2025 at 6:51 PM #249174Grazie Wim,
non uso la funzione TIMEFRAME proprio per evitare guai di quel genere, credo il problema sia un altro, comunque molto frustrante
perdere tempo così….
07/28/2025 at 6:52 PM #249175Scusa roberto cosa è il file itf?
07/28/2025 at 7:43 PM #24917707/29/2025 at 12:01 PM #249190Scusa roberto cosa è il file itf?
E’ il file creato dall’editor di ProRealTime. Quando vuoi salvare in locale sul tuo PC il codice, devi esportarlo mediante l’apposito pulsante (vedi foto, pressoché identica per indicatori, strategie e screener) e ti creerà il file crittografato ITF.
Il pulsante da usare è quello evidenziato in CELESTE, mentre il file è quello evidenziato in ARANCIO (ovviamente tu sceglierai uno dei tuoi codici), segui le indicazioni per dirgli dove andare a salvare il file con estenzione ITF (non è un testo visibile).
-
AuthorPosts
Find exclusive trading pro-tools on