COSTRUZIONE INDICATORE PER ANALISI CICLICA CON VISUAL TRADER (4 lettori)

Hell75

Nuovo forumer
forse così è un po' più comprensibile :)

1253291842screenhunter02sep.1818.35.png
 

solospread

Forumer storico
Codice:
Var: miomov1,miomax1,miomin1,AA,BB;
 
miomax1 = HHV(H,30);
miomin1 = LLv(L,30);
miomov1 = MOV(C,3,s);
AA = ((miomax1 - C)+ (miomov1)*miomax1)/C;
BB = ((miomin1 - C)+ (miomov1)*miomin1)/C;
plotchart( AA,0,red,solid,1);
plotchart( BB,0,blue,solid,1);

E' possibile costruire le bande di Solos per metatrader?
Mi piacerebbe plottare le sue bande sulla piattaforma di prova del forex.
Grazie:)[/QUOTE]
Questo è un lavoretto per il mio conterraneo tina232.:up::up::up:
 

tina232

Nuovo forumer
va bene....
ecco il codice x metatrader:

//+------------------------------------------------------------------+
//| Tiz SoloBB.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""

#property indicator_chart_window
#property indicator_buffers 2
bool Log = false;

//---- buffers
double SoloSU[];
double SoloGIU[];


//---- input parameters
extern int MPrd=34;
//#include <TizFunction.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2, Red);
SetIndexBuffer(0, SoloSU);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2, Chartreuse);
SetIndexBuffer(1, SoloGIU);

//---- name for DataWindow and indicator subwindow label
string short_name = "SoloBB";
IndicatorShortName(short_name);
SetIndexLabel(0, "SoloSU");
SetIndexLabel(1, "SoloGIU");

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit = 0;
string sS;
double max = 0, min = 0, mov = 0, bsu = 0, bgiu = 0;
//----

if(counted_bars>0) counted_bars--;

//limit = Bars - counted_bars -1 - MPrd;
//limit = Bars - counted_bars;
limit = Bars - 1 - MPrd;
for (int i=limit; i >= 0; i--)
{
max = High[ArrayMaximum(High, 30, i)];
min = Low[ArrayMinimum(Low, 30, i)];
mov = iMA(Symbol(), Period(), 3, 0, MODE_SMA, PRICE_CLOSE, i);
// (il massimo degli ultimi 30gg - chiusura attuale) + la media * massimo / chiusura attuale;
// in pratica la differenza con il max degli ultimi 30 giorni corretto con l'aggiunta di....
//
bsu = ( max - Close ) + ( mov * max) / Close;
bgiu = ( min - Close ) + ( mov * min) / Close;
SoloSU = bsu;
SoloGIU = bgiu;
//if (Log)
//{ sS = "i="+i+" bsu = "+bsu+" bgiu="+bgiu;
// HTMLRiga("TraceSoloBB", sS, false);
//}
}
//----
return(0);
}
//+------------------------------------------------------------------+
 

Hell75

Nuovo forumer
Complimenti Hell , gran bel lavoro. Nel fine settimana me lo studio. Come principio di fondo mi sembra che ci sia della sostanza, ovviamente và sviluppato, ma anche ieri nel durante ho potuto notare che funziona.

:):):):)

Il primo problme aè nel GETDATA, non riesco a definire una variabile per poi togliere N candele x avere la data corretta riferita al vero MAX.

DataPunto1 = GetDate;

ma dovrebbe essere la data 3 camndele più indietro...
 

Wile Coyote

Nuovo forumer
va bene....
ecco il codice x metatrader:

//+------------------------------------------------------------------+
//| Tiz SoloBB.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""

#property indicator_chart_window
#property indicator_buffers 2
bool Log = false;

//---- buffers
double SoloSU[];
double SoloGIU[];


//---- input parameters
extern int MPrd=34;
//#include <TizFunction.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2, Red);
SetIndexBuffer(0, SoloSU);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2, Chartreuse);
SetIndexBuffer(1, SoloGIU);

//---- name for DataWindow and indicator subwindow label
string short_name = "SoloBB";
IndicatorShortName(short_name);
SetIndexLabel(0, "SoloSU");
SetIndexLabel(1, "SoloGIU");

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit = 0;
string sS;
double max = 0, min = 0, mov = 0, bsu = 0, bgiu = 0;
//----

if(counted_bars>0) counted_bars--;

//limit = Bars - counted_bars -1 - MPrd;
//limit = Bars - counted_bars;
limit = Bars - 1 - MPrd;
for (int i=limit; i >= 0; i--)
{
max = High[ArrayMaximum(High, 30, i)];
min = Low[ArrayMinimum(Low, 30, i)];
mov = iMA(Symbol(), Period(), 3, 0, MODE_SMA, PRICE_CLOSE, i);
// (il massimo degli ultimi 30gg - chiusura attuale) + la media * massimo / chiusura attuale;
// in pratica la differenza con il max degli ultimi 30 giorni corretto con l'aggiunta di....
//
bsu = ( max - Close ) + ( mov * max) / Close;
bgiu = ( min - Close ) + ( mov * min) / Close;
SoloSU = bsu;
SoloGIU = bgiu;
//if (Log)
//{ sS = "i="+i+" bsu = "+bsu+" bgiu="+bgiu;
// HTMLRiga("TraceSoloBB", sS, false);
//}
}
//----
return(0);
}
//+------------------------------------------------------------------+


Grazie per il codice. Scusami se approfitto ancora ma non sono riuscito a caricarlo sulla piattaforma. Mi puoi suggerire come fare?:)
 

Users who are viewing this thread

Alto