Aiuto per la codifica - pagina 25

 

Aiuto per favore....

PER FAVORE AIUTATEMI....

Spostamento della linea rossa media, la direzione della pendenza è sotto la linea

Linea blu media mobile, sotto la linea rossa è in movimento avarege

Prezzo "pendenza direzione linea" tempo di taglio

Tutto avviene nello stesso momento: dare un allarme INDma_crossover_lines.ex4ma_crossover_lines.mq4

pendenza_direzione_linea.ex4CATOR

Per favore aiutate

--

UmUt EtİkEr

 

Funzione di guadagno giornaliero, settimanale e mensile richiesta

Sto avendo problemi con alcuni codici. Sto cercando di creare un indicatore che mostri i guadagni giornalieri chiusi, settimanali chiusi e mensili chiusi.

Qualcuno ha una funzione che calcola i guadagni di questi periodi?

cioè.

Oggi chiuso: 5,3%

Settimana chiusa: 13.7%

Mese Chiuso: 41.3%

Anno Chiuso: 79.5%

Diciamo che so cosa deve essere fatto, ma ho problemi a farlo bene. Se qualcuno ha le funzioni che fanno questo può per favore aiutarmi?

 
Prova ad usare questo come base:
//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

//

//

//

// show statistics

//

//

//

double stat[18];

#define stat.OTodayBuy 0

#define stat.OTodaySell 1

#define stat.OTodayTotal 2

#define stat.OTodayBuyPips 3

#define stat.OTodaySellPips 4

#define stat.OTodayTotalPips 5

#define stat.TodayBuy 6

#define stat.TodaySell 7

#define stat.TodayTotal 8

#define stat.TodayBuyPips 9

#define stat.TodaySellPips 10

#define stat.TodayTotalPips 11

#define stat.TotalBuy 12

#define stat.TotalSell 13

#define stat.TotalTotal 14

#define stat.TotalBuyPips 15

#define stat.TotalSellPips 16

#define stat.TotalTotalPips 17

//

//

//

//

//

void stat.colect()

{

int pointRatio = MathPow(10,Digits%2);

int pipMultiplier = MathPow(10,Digits);

double temp;

//

//

//

//

//

ArrayInitialize(stat,0);

for(int i = 0; i < OrdersTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) break;

if(OrderMagicNumber() != MagicNumber) continue;

if(OrderSymbol() != Symbol()) continue;

if(OrderType()==OP_BUY || OrderType()==OP_SELL)

{

double tempa = OrderProfit()+OrderSwap();

double tempp = 0;

if (OrderType()==OP_BUY)

{

tempp = (Bid-OrderOpenPrice())*pipMultiplier/pointRatio;

stat[stat.OTodayBuy] += tempa;

stat[stat.OTodayBuyPips] += tempp;

}

else

{

tempp = (OrderOpenPrice()-Ask)*pipMultiplier/pointRatio;

stat[stat.OTodaySell] += tempa;

stat[stat.OTodaySellPips] += tempp;

}

}

stat[stat.OTodayTotal] += tempa;

stat[stat.OTodayTotalPips] += tempp;

}

//

//

//

// now check the history

//

//

//

datetime startTime = StrToTime(StringSubstr(TimeToStr(TimeCurrent()),0,10)+" 00:00");

datetime endTime = StrToTime(StringSubstr(TimeToStr(TimeCurrent()),0,10)+" 24:00");

//

//

//

//

//

for(i = 0; i < OrdersHistoryTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == false) break;

if(OrderMagicNumber() != MagicNumber) continue;

if(OrderSymbol() != Symbol()) continue;

//

//

//

//

//

bool isOutOfToday = (OrderCloseTime()endTime);

if(OrderType()==OP_BUY || OrderType()==OP_SELL)

{

tempa = OrderProfit()+OrderSwap();

tempp = 0;

if (OrderType()==OP_BUY)

{

tempp = (OrderClosePrice()-OrderOpenPrice())*pipMultiplier/pointRatio;

stat[stat.TotalBuy] += tempa;

stat[stat.TotalBuyPips] += tempp;

if (!isOutOfToday)

{

stat[stat.TodayBuy] += tempa;

stat[stat.TodayBuyPips] += tempp;

}

}

else

{

tempp = (OrderOpenPrice()-OrderClosePrice())*pipMultiplier/pointRatio;

stat[stat.TotalSell] += tempa;

stat[stat.TotalSellPips] += tempp;

if (!isOutOfToday)

{

stat[stat.TodaySell] += tempa;

stat[stat.TodaySellPips] += tempp;

}

}

//

//

//

//

//

if (!isOutOfToday)

{

stat[stat.TodayTotal] += tempa;

stat[stat.TodayTotalPips] += tempp;

}

stat[stat.TotalTotal] += tempa;

stat[stat.TotalTotalPips] += tempp;

}

}

}

void showStatistics()

{

if (!showStatistics) return;

//

//

//

//

//

stat.colect();

createLabel( 1,"opened buy profit" ,stat[stat.OTodayBuy] , 10);

createLabel( 2,"opened buy profit (pips)" ,stat[stat.OTodayBuyPips] , 20,0);

createLabel( 3,"opened sell profit" ,stat[stat.OTodaySell] , 30);

createLabel( 4,"opened sell profit (pips)",stat[stat.OTodaySellPips] , 40,0);

createLabel( 5,"opened profit" ,stat[stat.OTodayTotal] , 50);

createLabel( 6,"opened profit (pips)" ,stat[stat.OTodayTotalPips], 60,0);

createLabel( 7,"daily buy profit" ,stat[stat.TodayBuy] , 80);

createLabel( 8,"daily buy profit (pips)" ,stat[stat.TodayBuyPips] , 90,0);

createLabel( 9,"daily sell profit" ,stat[stat.TodaySell] ,100);

createLabel(10,"daily sell profit (pips)" ,stat[stat.TodaySellPips] ,110,0);

createLabel(11,"daily profit" ,stat[stat.TodayTotal] ,120);

createLabel(12,"daily profit (pips)" ,stat[stat.TodayTotalPips] ,130,0);

createLabel(13,"total buy profit" ,stat[stat.TotalBuy] ,150);

createLabel(14,"total buy profit (pips)" ,stat[stat.TotalBuyPips] ,160,0);

createLabel(15,"total sell profit" ,stat[stat.TotalSell] ,170);

createLabel(16,"total sell profit (pips)" ,stat[stat.TotalSellPips] ,180,0);

createLabel(17,"total profit" ,stat[stat.TotalTotal] ,190);

createLabel(18,"total profit (pips)" ,stat[stat.TotalTotalPips] ,200,0);

WindowRedraw();

}

//

//

//

//

//

void createLabel(string lname, string text, double value,int ypos,int decimals=2)

{

string name = "stat."+lname;

if (ObjectFind(name) == -1)

{

ObjectCreate(name,OBJ_LABEL,0,0,0);

ObjectSet(name,OBJPROP_CORNER ,0);

ObjectSet(name,OBJPROP_XDISTANCE,5);

ObjectSet(name,OBJPROP_YDISTANCE,ypos+5);

}

ObjectSetText(name,text,9,"Arial",Gray);

//

//

//

//

//

name = name+"value";

if (ObjectFind(name) == -1)

{

ObjectCreate(name,OBJ_LABEL,0,0,0);

ObjectSet(name,OBJPROP_CORNER ,0);

ObjectSet(name,OBJPROP_XDISTANCE,145);

ObjectSet(name,OBJPROP_YDISTANCE,ypos+5);

}

color theColor = DimGray;

if (value < 0) theColor = Orange;

if (value > 0) theColor = Lime;

ObjectSetText(name,DoubleToStr(value,decimals),9,"Arial",theColor);

}

avete una statistica aperta, giornaliera e totale coperta in questa. Aggiungere le statistiche settimanali e mensili non dovrebbe essere difficile (basta seguire la logica della raccolta dati giornaliera)

sbwent:
Sto avendo problemi con alcuni codici. Sto cercando di creare un indicatore che visualizzi i guadagni giornalieri chiusi, settimanali chiusi e mensili chiusi.

Qualcuno ha una funzione che calcola i guadagni di questi periodi?

Cioè.

Oggi chiuso: 5,3%

Settimana chiusa: 13.7%

Mese Chiuso: 41.3%

Anno Chiuso: 79.5%

Diciamo che so cosa deve essere fatto, ma ho problemi a farlo bene. Se qualcuno ha le funzioni per fare questo può aiutarmi per favore?
 

Grazie, farò una prova

mladen:
Prova ad usare questo come base:
//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

//

//

//

// show statistics

//

//

//

double stat[18];

#define stat.OTodayBuy 0

#define stat.OTodaySell 1

#define stat.OTodayTotal 2

#define stat.OTodayBuyPips 3

#define stat.OTodaySellPips 4

#define stat.OTodayTotalPips 5

#define stat.TodayBuy 6

#define stat.TodaySell 7

#define stat.TodayTotal 8

#define stat.TodayBuyPips 9

#define stat.TodaySellPips 10

#define stat.TodayTotalPips 11

#define stat.TotalBuy 12

#define stat.TotalSell 13

#define stat.TotalTotal 14

#define stat.TotalBuyPips 15

#define stat.TotalSellPips 16

#define stat.TotalTotalPips 17

//

//

//

//

//

void stat.colect()

{

int pointRatio = MathPow(10,Digits%2);

int pipMultiplier = MathPow(10,Digits);

double temp;

//

//

//

//

//

ArrayInitialize(stat,0);

for(int i = 0; i < OrdersTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == false) break;

if(OrderMagicNumber() != MagicNumber) continue;

if(OrderSymbol() != Symbol()) continue;

if(OrderType()==OP_BUY || OrderType()==OP_SELL)

{

double tempa = OrderProfit()+OrderSwap();

double tempp = 0;

if (OrderType()==OP_BUY)

{

tempp = (Bid-OrderOpenPrice())*pipMultiplier/pointRatio;

stat[stat.OTodayBuy] += tempa;

stat[stat.OTodayBuyPips] += tempp;

}

else

{

tempp = (OrderOpenPrice()-Ask)*pipMultiplier/pointRatio;

stat[stat.OTodaySell] += tempa;

stat[stat.OTodaySellPips] += tempp;

}

}

stat[stat.OTodayTotal] += tempa;

stat[stat.OTodayTotalPips] += tempp;

}

//

//

//

// now check the history

//

//

//

datetime startTime = StrToTime(StringSubstr(TimeToStr(TimeCurrent()),0,10)+" 00:00");

datetime endTime = StrToTime(StringSubstr(TimeToStr(TimeCurrent()),0,10)+" 24:00");

//

//

//

//

//

for(i = 0; i < OrdersHistoryTotal(); i++)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY) == false) break;

if(OrderMagicNumber() != MagicNumber) continue;

if(OrderSymbol() != Symbol()) continue;

//

//

//

//

//

bool isOutOfToday = (OrderCloseTime()endTime);

if(OrderType()==OP_BUY || OrderType()==OP_SELL)

{

tempa = OrderProfit()+OrderSwap();

tempp = 0;

if (OrderType()==OP_BUY)

{

tempp = (OrderClosePrice()-OrderOpenPrice())*pipMultiplier/pointRatio;

stat[stat.TotalBuy] += tempa;

stat[stat.TotalBuyPips] += tempp;

if (!isOutOfToday)

{

stat[stat.TodayBuy] += tempa;

stat[stat.TodayBuyPips] += tempp;

}

}

else

{

tempp = (OrderOpenPrice()-OrderClosePrice())*pipMultiplier/pointRatio;

stat[stat.TotalSell] += tempa;

stat[stat.TotalSellPips] += tempp;

if (!isOutOfToday)

{

stat[stat.TodaySell] += tempa;

stat[stat.TodaySellPips] += tempp;

}

}

//

//

//

//

//

if (!isOutOfToday)

{

stat[stat.TodayTotal] += tempa;

stat[stat.TodayTotalPips] += tempp;

}

stat[stat.TotalTotal] += tempa;

stat[stat.TotalTotalPips] += tempp;

}

}

}

void showStatistics()

{

if (!showStatistics) return;

//

//

//

//

//

stat.colect();

createLabel( 1,"opened buy profit" ,stat[stat.OTodayBuy] , 10);

createLabel( 2,"opened buy profit (pips)" ,stat[stat.OTodayBuyPips] , 20,0);

createLabel( 3,"opened sell profit" ,stat[stat.OTodaySell] , 30);

createLabel( 4,"opened sell profit (pips)",stat[stat.OTodaySellPips] , 40,0);

createLabel( 5,"opened profit" ,stat[stat.OTodayTotal] , 50);

createLabel( 6,"opened profit (pips)" ,stat[stat.OTodayTotalPips], 60,0);

createLabel( 7,"daily buy profit" ,stat[stat.TodayBuy] , 80);

createLabel( 8,"daily buy profit (pips)" ,stat[stat.TodayBuyPips] , 90,0);

createLabel( 9,"daily sell profit" ,stat[stat.TodaySell] ,100);

createLabel(10,"daily sell profit (pips)" ,stat[stat.TodaySellPips] ,110,0);

createLabel(11,"daily profit" ,stat[stat.TodayTotal] ,120);

createLabel(12,"daily profit (pips)" ,stat[stat.TodayTotalPips] ,130,0);

createLabel(13,"total buy profit" ,stat[stat.TotalBuy] ,150);

createLabel(14,"total buy profit (pips)" ,stat[stat.TotalBuyPips] ,160,0);

createLabel(15,"total sell profit" ,stat[stat.TotalSell] ,170);

createLabel(16,"total sell profit (pips)" ,stat[stat.TotalSellPips] ,180,0);

createLabel(17,"total profit" ,stat[stat.TotalTotal] ,190);

createLabel(18,"total profit (pips)" ,stat[stat.TotalTotalPips] ,200,0);

WindowRedraw();

}

//

//

//

//

//

void createLabel(string lname, string text, double value,int ypos,int decimals=2)

{

string name = "stat."+lname;

if (ObjectFind(name) == -1)

{

ObjectCreate(name,OBJ_LABEL,0,0,0);

ObjectSet(name,OBJPROP_CORNER ,0);

ObjectSet(name,OBJPROP_XDISTANCE,5);

ObjectSet(name,OBJPROP_YDISTANCE,ypos+5);

}

ObjectSetText(name,text,9,"Arial",Gray);

//

//

//

//

//

name = name+"value";

if (ObjectFind(name) == -1)

{

ObjectCreate(name,OBJ_LABEL,0,0,0);

ObjectSet(name,OBJPROP_CORNER ,0);

ObjectSet(name,OBJPROP_XDISTANCE,145);

ObjectSet(name,OBJPROP_YDISTANCE,ypos+5);

}

color theColor = DimGray;

if (value < 0) theColor = Orange;

if (value > 0) theColor = Lime;

ObjectSetText(name,DoubleToStr(value,decimals),9,"Arial",theColor);

}

hai una statistica aperta, giornaliera e totale coperta in questo. Aggiungere le statistiche settimanali e mensili non dovrebbe essere difficile (basta seguire la logica della raccolta dati giornaliera)

Grazie, sei stato di grande aiuto. Vedrò se riesco a risolvere il problema a partire da questo.

 

Mtf cci hook

Ragazzi, qualcuno può dare un'occhiata e aiutarmi con l'indicatore CCI hook allegato, ho aggiunto la funzione MTF in esso ma vorrei vedere i punti allineati orizzontalmente e non riesco a gestirlo .. o solo un punto dalla barra chiusa del TF superiore.

Grazie in anticipo.

ccihookmtff.mq4

File:
 

...

Prova qualcosa come questo. Questo mostra tutti i punti del target time frame allineati orizzontalmente

altoronto:
Ragazzi, qualcuno può dare un'occhiata e aiutarmi con l'indicatore CCI hook allegato, ho aggiunto la funzione MTF ma vorrei vedere i punti allineati orizzontalmente e non ci riesco... o solo un punto dalla barra chiusa del TF superiore.

Grazie in anticipo.

ccihookmtf.mq4
File:
 
mladen:
Prova qualcosa come questo. Questo mostra tutti i punti del target time frame allineati orizzontalmente

Grazie Mladen, sai davvero come torturare i dati

 

...

Se vuoi limitarlo a un solo punto per barra di time frame di destinazione (la prima barra appartenente alla barra di time frame di destinazione in questo caso), allora potresti fare qualcosa come quello che è stato fatto in questa versione (nell'esempio è un gancio cci di un'ora su grafico a 15 minuti - opzione aggiunta all'indicatore in modo che tu possa scegliere)

altoronto:
Grazie Mladen, sai davvero come torturare i dati
File:
cci_hk.gif  28 kb
 

ciao ragazzi

come posso ottenere il tempo del prossimo bar

Ho provato

datetime Tempo[-1];

che non ha funzionato

saluti

 

Orario futuro del bar ....

Prova così :
datetime futureBarTime = Time[0]+Period()*60;
Deorn:
ciao ragazzi

come posso ottenere il tempo della prossima barra

Ho provato

datetime Tempo[-1];

che non ha funzionato

saluti
Motivazione: