Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // BIAS ANALYZER 60m [INDICATORE] QTA Mastermind
- // Vedi Video 1 Cartella Mastermind QTA
- // Impostare il timeframe a 60 minuti !!!
- // Questo indicatore calcola la somma positiva o negativa di tutte le ore dal passato fini ad oggi, ma potremmo anche avere anni molto forti come variazione e anni molto deboli
- // quindi dopo averlo lanciato per tutto lo storico bisogna spulciare il dataframe di anno in anno salvandosi i risultati per capire se il mercato è ancora coerente con il bias in atto !!!.
- const: MaxBarsAllowed(50);
- array: countPerHour[23](0),
- deltaSumPerHour[23](0),
- avgPerHour[23](0),
- cumPerHour[23](0);
- var: maxSessionBars(0), barsThisSession(0), ix(0), currentHour(0);
- if d <> d[1] then begin
- maxSessionBars = MaxList(barsThisSession, maxSessionBars);
- barsThisSession = 0;
- if maxSessionBars > 0 then begin
- maxSessionBars = IFF(maxSessionBars < MaxBarsAllowed, maxSessionBars, MaxBarsAllowed);
- for ix = 0 to 23 begin
- if countPerHour[ix] > 0 then
- avgPerHour[ix] = deltaSumPerHour[ix] / countPerHour[ix];
- if ix > 0 then
- cumPerHour[ix] = avgPerHour[ix] + cumPerHour[ix - 1];
- end;
- for ix = 0 to 23 begin
- if countPerHour[ix] > 0 then begin
- Plot1[maxSessionBars - ix + 1](avgPerHour[ix] * BigPointValue, "Avg $ Movement");
- end;
- end;
- end;
- end;
- // Mostra la tabella oraria nel Commentary SOLO sull?ultima barra
- if LastBarOnChart then begin
- var: tableHTML(""),
- bestIx(0), worstIx(0),
- bestVal(-999999.0), worstVal(999999.0),
- val(0);
- // Trova migliore e peggiore media in $
- for ix = 0 to 23 begin
- if countPerHour[ix] > 0 then begin
- val = avgPerHour[ix] * BigPointValue;
- if val > bestVal then begin
- bestVal = val;
- bestIx = ix;
- end;
- if val < worstVal then begin
- worstVal = val;
- worstIx = ix;
- end;
- end;
- end;
- // Genera tabella
- tableHTML = "<style>table{font-size:11px;border-collapse:collapse;}th{background:#eee;}td,th{border:1px solid #999;padding:4px 6px;text-align:center;} .green{background:#e1f5e1;font-weight:bold;} .red{background:#fce4e4;font-weight:bold;}</style>";
- tableHTML = tableHTML + "<table><tr><th>Ora</th><th>Media Punti</th><th>Media $</th></tr>";
- for ix = 0 to 23 begin
- if countPerHour[ix] > 0 then begin
- val = avgPerHour[ix] * BigPointValue;
- if ix = bestIx then
- tableHTML = tableHTML + "<tr class='green'>"
- else if ix = worstIx then
- tableHTML = tableHTML + "<tr class='red'>"
- else if avgPerHour[ix] > 0 then
- tableHTML = tableHTML + "<tr style='background:#f0fff0;'>"
- else if avgPerHour[ix] < 0 then
- tableHTML = tableHTML + "<tr style='background:#fff0f0;'>"
- else
- tableHTML = tableHTML + "<tr style='background:#f8f8f8;'>";
- tableHTML = tableHTML +
- "<td>" + numtostr(ix, 0) + ":00</td>" +
- "<td>" + numtostr(avgPerHour[ix], 3) + "</td>" +
- "<td>" + numtostr(val, 2) + "</td></tr>";
- end;
- end;
- tableHTML = tableHTML + "</table>";
- CommentaryCL(tableHTML);
- end;
- ///////// !!! MULTICHARTS /////////
- // Aggiorna i dati per l'ora corrente
- //currentHour = HoursFromDateTime(datetime); // !!! MULTICHARTS
- ///////// !!! TRADESTATION /////////
- // ATTENZIONE SE L'INDICATORE RICHIEDE PIù BARRE: APPLICARE L'INIDICATORE AL GRAFICO / TASTO DESTRO SUL GRAFICO/ STUDIES / EDIT STUDIES / STATUS / CUSTOMIZES / GENERAL /
- /// MAXIMUM OF BARS STUDY WILL REFERENCE / USER DEFINED 1000 O UN NUMERO CONGRUO A FAR CARICARE L'INDICATORE QUASI DALL'INIZIO ALLA FINE DI TUTTO LO STORICO
- // Aggiorna i dati per l'ora corrente
- currentHour = IntPortion(Time / 100); // !!! TRADESTATION
- if currentHour < MaxBarsAllowed then begin
- countPerHour[currentHour] = countPerHour[currentHour] + 1;
- deltaSumPerHour[currentHour] = deltaSumPerHour[currentHour] + (c - c[1]);
- end;
- barsThisSession = barsThisSession + 1;
- //////////////////////////////////// //////////////////////////////////// //////////////////////////////////// ////////////////////////////////////
- // Aggiunto Personalmente il Print Debug !!!
- if LastBarOnChart then begin
- Print("Medie punti per ora:");
- Print("00: ", NumToStr(avgPerHour[0], 3)); // Cambia i decimali del print ultimo numero prima della chiusura dell'ultima parentesi tonda !!!
- Print("01: ", NumToStr(avgPerHour[1], 3));
- Print("02: ", NumToStr(avgPerHour[2], 3));
- Print("03: ", NumToStr(avgPerHour[3], 3));
- Print("04: ", NumToStr(avgPerHour[4], 3));
- Print("05: ", NumToStr(avgPerHour[5], 3));
- Print("06: ", NumToStr(avgPerHour[6], 3));
- Print("07: ", NumToStr(avgPerHour[7], 3));
- Print("08: ", NumToStr(avgPerHour[8], 3));
- Print("09: ", NumToStr(avgPerHour[9], 3));
- Print("10: ", NumToStr(avgPerHour[10], 3));
- Print("11: ", NumToStr(avgPerHour[11], 3));
- Print("12: ", NumToStr(avgPerHour[12], 3));
- Print("13: ", NumToStr(avgPerHour[13], 3));
- Print("14: ", NumToStr(avgPerHour[14], 3));
- Print("15: ", NumToStr(avgPerHour[15], 3));
- Print("16: ", NumToStr(avgPerHour[16], 3));
- Print("17: ", NumToStr(avgPerHour[17], 3));
- Print("18: ", NumToStr(avgPerHour[18], 3));
- Print("19: ", NumToStr(avgPerHour[19], 3));
- Print("20: ", NumToStr(avgPerHour[20], 3));
- Print("21: ", NumToStr(avgPerHour[21], 3));
- Print("22: ", NumToStr(avgPerHour[22], 3));
- Print("23: ", NumToStr(avgPerHour[23], 3));
- end;
- // Aggiunto Personalmente il Print Debug !!!
- if LastBarOnChart then begin
- Print("Medie in $ per ora:");
- Print("00: ", NumToStr(avgPerHour[0] * BigPointValue, 2)); // Cambia i decimali del print ultimo numero prima della chiusura dell'ultima parentesi tonda !!!
- Print("01: ", NumToStr(avgPerHour[1] * BigPointValue, 2));
- Print("02: ", NumToStr(avgPerHour[2] * BigPointValue, 2));
- Print("03: ", NumToStr(avgPerHour[3] * BigPointValue, 2));
- Print("04: ", NumToStr(avgPerHour[4] * BigPointValue, 2));
- Print("05: ", NumToStr(avgPerHour[5] * BigPointValue, 2));
- Print("06: ", NumToStr(avgPerHour[6] * BigPointValue, 2));
- Print("07: ", NumToStr(avgPerHour[7] * BigPointValue, 2));
- Print("08: ", NumToStr(avgPerHour[8] * BigPointValue, 2));
- Print("09: ", NumToStr(avgPerHour[9] * BigPointValue, 2));
- Print("10: ", NumToStr(avgPerHour[10] * BigPointValue, 2));
- Print("11: ", NumToStr(avgPerHour[11] * BigPointValue, 2));
- Print("12: ", NumToStr(avgPerHour[12] * BigPointValue, 2));
- Print("13: ", NumToStr(avgPerHour[13] * BigPointValue, 2));
- Print("14: ", NumToStr(avgPerHour[14] * BigPointValue, 2));
- Print("15: ", NumToStr(avgPerHour[15] * BigPointValue, 2));
- Print("16: ", NumToStr(avgPerHour[16] * BigPointValue, 2));
- Print("17: ", NumToStr(avgPerHour[17] * BigPointValue, 2));
- Print("18: ", NumToStr(avgPerHour[18] * BigPointValue, 2));
- Print("19: ", NumToStr(avgPerHour[19] * BigPointValue, 2));
- Print("20: ", NumToStr(avgPerHour[20] * BigPointValue, 2));
- Print("21: ", NumToStr(avgPerHour[21] * BigPointValue, 2));
- Print("22: ", NumToStr(avgPerHour[22] * BigPointValue, 2));
- Print("23: ", NumToStr(avgPerHour[23] * BigPointValue, 2));
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement