Aide au codage - page 25

 

Aidez-nous s'il vous plaît....

AIDEZ-VOUS....

Ligne rouge moyenne mobile, la direction de la pente est sous la ligne.

Moving avarage ligne bleue, sous la ligne rouge est en mouvement avarege

Prix "direction de la pente Ligne" temps coupé

Tout se passe en même temps : DONNE UNE ALARME INDma_crossover_lines.ex4ma_crossover_lines.mq4

slope_direction_line.ex4CATOR

Aidez-nous

--

UmUt EtİkEr

 

Fonction de gains quotidiens, hebdomadaires et mensuels requise

J'ai des problèmes avec le codage. J'essaie de créer un indicateur qui affiche les gains quotidiens fermés, les gains hebdomadaires fermés et les gains mensuels fermés.

Quelqu'un a-t-il une fonction qui calcule les gains de ces périodes ?

Par exemple.

Fermé aujourd'hui : 5,3

Fermeture hebdomadaire : 13,7

Fermé le mois : 41.3%

Année Fermée : 79.5%

Je sais en quelque sorte ce qu'il faut faire mais j'ai du mal à le faire correctement. Si quelqu'un possède les fonctions nécessaires, pouvez-vous m'aider ?

 
Essayez d'utiliser ceci comme 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);

}

vous avez une ouverture, des statistiques quotidiennes et totales couvertes dans celui-ci. Ajouter des statistiques hebdomadaires et mensuelles ne devrait pas être trop difficile (il suffit de suivre la logique de la collecte des données quotidiennes).

sbwent:
J'ai des problèmes avec le codage. J'essaie de créer un indicateur qui affiche les gains quotidiens fermés, les gains hebdomadaires fermés et les gains mensuels fermés.

Est-ce que quelqu'un a une fonction qui calcule les gains de ces périodes ?

Par exemple.

Clôture aujourd'hui : 5,3

Semaine clôturée : 13,7

Fermé le mois : 41.3%

Année Fermée : 79.5%

Je sais en quelque sorte ce qu'il faut faire mais j'ai du mal à le faire correctement. Si quelqu'un possède les fonctions nécessaires, pouvez-vous m'aider ?
 

Merci, je vais essayer.

mladen:
Essayez d'utiliser ceci comme 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);

}

vous avez une ouverture, des statistiques quotidiennes et totales couvertes dans celui-ci. Ajouter des statistiques hebdomadaires et mensuelles ne devrait pas être trop difficile (il suffit de suivre la logique de la collecte des données quotidiennes).

Merci, vous m'avez été d'une grande aide. Je vais voir si je peux le faire à partir de ça.

 

Mtf cci hook

Les gars, quelqu'un peut-il jeter un coup d'oeil et m'aider avec l'indicateur CCI hook ci-joint, j'y ai ajouté la fonction MTF mais je voudrais voir les points alignés horizontalement et je n'y arrive pas ... ou juste un point de la barre fermée du TF supérieur.

Merci d'avance.

ccihookmtf.mq4

Dossiers :
 

...

Essayez quelque chose comme ça. Celui-ci montre tous les points de l'image temporelle cible alignés horizontalement.

altoronto:
Les gars, quelqu'un peut-il jeter un coup d'oeil et m'aider avec l'indicateur CCI hook ci-joint, j'ai ajouté la fonction MTF mais je voudrais voir les points alignés horizontalement et je n'y arrive pas ... ou juste un point de la barre fermée du TF supérieur.

Merci d'avance.

ccihookmtf.mq4
Dossiers :
 
mladen:
Essayez quelque chose comme ça. Celui-ci montre tous les points de la trame temporelle cible alignés horizontalement.

Merci Mladen, vous savez vraiment comment torturer les données.

 

...

Si vous voulez le limiter à un seul point par barre d'horizon temporel cible (première barre appartenant à la barre d'horizon temporel cible dans ce cas), alors vous pourriez faire quelque chose comme ce qui a été fait dans cette version (dans l'exemple, il s'agit d'un crochet cci d'une heure sur un graphique de 15 minutes - option ajoutée à l'indicateur pour que vous puissiez choisir).

altoronto:
Merci Mladen, vous savez vraiment comment torturer les données
Dossiers :
cci_hk.gif  28 kb
 

Salut les gars

Comment puis-je obtenir l'heure du prochain bar ?

J'ai essayé

datetime Temps[-1] ;

ce qui n'a pas fonctionné

salutations

 

Heure du futur bar ....

Essayez comme ceci :
datetime futureBarTime = Time[0]+Period()*60;
Deorn:
Salut les gars

Comment puis-je obtenir l'heure de la barre à venir ?

J'ai essayé

datetime Temps[-1] ;

ce qui n'a pas fonctionné

salutations
Raison: