gryps2/UI-code/T-043_ChartComment.txt

287 lines
30 KiB
Text
Raw Permalink Normal View History

2025-05-30 14:58:21 +02:00
<EFBFBD><EFBFBD>int OnInit()
{
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>rKah<61>:y
if (!IsTesting())
{
//CenterSymbol(); // %R<14><>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0)R(uY0<59>04XTo00<>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0HQk0<18> <09>0g0j0D0h0<68>0<EFBFBD>0<EFBFBD>0<EFBFBD>0L0<4C>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0KbMRk0h<30>:yU0<55>0<EFBFBD>00
ChartComment();
}
}
void OnTick()
{
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>rKah<61>:y
if (!IsTesting())
{
ChartComment(); // <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
}
}
//+------------------------------------------------------------------+
//| <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h<30>:y |
//+------------------------------------------------------------------+
void ChartComment()
{
// <00>rKak0<6B>0c0f0r<30> Y<>f
color clrChartWar = ChartWarning >= 2? clrNONE : clrWhite;
color clrChartWarPP = ChartWarning >= 2? clrNONE : totalpips < 0? clrOrangeRed : clrWhite;
color clrChartWarPF = ChartWarning >= 2? clrNONE : 0 < ProfitFactor && ProfitFactor < 1? clrOrangeRed : clrWhite;
string LotsComment;
if (MM_ON == Fixed) LotsComment = DoubleToStr(Lots,2);
else LotsComment = DoubleToStr(CalculateLots(MM_Risk, StopLoss_pips),2) +
" (" + DoubleToStr(MM_Risk,1) +"%)";
string Comment0 = "Magic : " + (string)MagicNumber;
string Comment1 = "Lots : " + LotsComment;
string Comment2 = "MM : " + (MM_ON == 0 ? "Fixed" : MM_ON == 1 ? "FreeMargin" : MM_ON == 2 ? "Balance" : "AddCredit");
string Comment3 = "Summertime : " + (Summertime == 0 ? "none" : Summertime == 1 ? "US" : "UK");
string Comment4 = "Spread Lim/Ave : " + DoubleToStr(MaxSpread_pips,1) + "/" + DoubleToStr(SpreadAve,1);
string Comment5 = "Stoploss B/S : " + DoubleToStr(StopLoss_pips_buy, 0) + "/" + DoubleToStr(StopLoss_pips_sell, 0);
string Comment6 = "Swap B/S : " + DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG), 2) + "/" +
DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT), 2);
string Comment7 = "TradeCounts : " + DoubleToStr(TradeCounts, 0);
string Comment8 = "Profit (pips) : " + DoubleToStr(totalpips, 1);
string Comment9 = (plus_profit == 0 || minus_profit == 0? "Profit factor : ---" :
"Profit factor : " + DoubleToStr(ProfitFactor, 2));
string Comment10 = (plus_profit == 0 || minus_profit == 0? "RRR/Win% : ---/---" :
"RRR/Win% : " + DoubleToStr(RRR, 2) + "/" + DoubleToStr(WinPer, 1));
CommentLabel("ComObj0", Comment0, 4, 38, 10, clrYellow);
CommentLabel("ComObj1", Comment1, 4, 58, 10, clrYellow);
CommentLabel("ComObj2", Comment2, 6, 82, 8, clrChartWar);
CommentLabel("ComObj3", Comment3, 6, 100, 8, clrChartWar);
CommentLabel("ComObj4", Comment4, 6, 118, 8, clrChartWar);
CommentLabel("ComObj5", Comment5, 6, 136, 8, clrChartWarPP);
CommentLabel("ComObj6", Comment6, 6, 154, 8, clrChartWarPF);
CommentLabel("ComObj7", Comment7, 6, 172, 8, clrChartWar);
CommentLabel("ComObj8", Comment8, 6, 190, 8, clrChartWar);
CommentLabel("ComObj9", Comment9, 6, 208, 8, clrChartWar);
CommentLabel("ComObj10", Comment10, 6, 226, 8, clrChartWar);
}
//+------------------------------------------------------------------+
void CommentLabel(string ComName, string ComText, int ComPos_x, int ComPos_y, int ComSize, color ComClr= clrBlack)
{
ComPos_x = (int)NormalizeDouble(ComPos_x * DPIAdjust, 0); // %R<14>DPI<00>c<EFBFBD>{<7B>0<EFBFBD>0<EFBFBD>0g0<67><30>te
ComPos_y = (int)NormalizeDouble(ComPos_y * DPIAdjust, 0); // %R<14>DPI<00>c<EFBFBD>{<7B>0<EFBFBD>0<EFBFBD>0g0<67><30>te
ObjectCreate(ComName, OBJ_LABEL, 0, 0, 0);
ObjectSetString (0, ComName, OBJPROP_TEXT, ComText);
ObjectSetInteger(0, ComName, OBJPROP_XDISTANCE, ComPos_x);
ObjectSetInteger(0, ComName, OBJPROP_YDISTANCE, ComPos_y);
ObjectSetInteger(0, ComName, OBJPROP_FONTSIZE, ComSize);
ObjectSetInteger(0, ComName, OBJPROP_COLOR, ComClr);
ObjectSetString (0, ComName, OBJPROP_FONT, "Segoe UI");
ObjectSetInteger(0, ComName, OBJPROP_BACK, true);
ObjectSetInteger(0, ComName, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, ComName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, ComName, OBJPROP_ANCHOR, ANCHOR_RIGHT_UPPER);
}
//+------------------------------------------------------------------+
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0(u
//+------------------------------------------------------------------+
//| <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h<30>:y |
//+------------------------------------------------------------------+
void ChartComment()
{
color clrChartWar = ChartWarning >= 2? clrNONE : clrWhite;
color clrChartWarPP = ChartWarning >= 2? clrNONE : totalpips < 0? clrOrangeRed : clrWhite;
color clrChartWarPF = ChartWarning >= 2? clrNONE : 0 < ProfitFactor && ProfitFactor < 1? clrOrangeRed : clrWhite;
color clrChartWarCom = (_Comment == "" || StringLen(_Comment) > 31) ? clrOrangeRed : clrChartWar;
string LotsComment;
if (MM_ON == Fixed) LotsComment = DoubleToStr(Lots,2);
else LotsComment = DoubleToStr(CalculateLots(MM_Risk, StopLoss_pips),2) +
" (" + DoubleToStr(MM_Risk,1) +"%)";
string Comment0 = "Magic : " + (string)MagicNumber;
string Comment1 = "Lots : " + LotsComment;
string Comment2 = "MM : " + (MM_ON == 0 ? "Fixed" : MM_ON == 1 ? "FreeMargin" : MM_ON == 2 ? "Balance" : "AddCredit");
//string Comment3 = "Summertime : " + (Summertime == 0 ? "none" : Summertime == 1 ? "US" : "UK");
string Comment3 = "Stoploss B/S : " + DoubleToStr(StopLoss_pips_buy, 0) + "/" + DoubleToStr(StopLoss_pips_sell, 0);
string Comment4 = "Swap B/S : " + DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG), 2) + "/" +
DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT), 2);
string Comment5 = "Spread Lim/Ave : " + DoubleToStr(MaxSpread_pips,1) + "/" + DoubleToStr(SpreadAve,1);
string Comment6 = "TradeCounts : " + DoubleToStr(TradeCounts, 0);
string Comment7 = "Profit (pips) : " + DoubleToStr(totalpips, 1);
string Comment8 = (plus_profit == 0 || minus_profit == 0? "Profit factor : ---" :
"Profit factor : " + DoubleToStr(ProfitFactor, 2));
string Comment9 = (plus_profit == 0 || minus_profit == 0? "RRR/Win% : ---/---" :
"RRR/Win% : " + DoubleToStr(RRR, 2) + "/" + DoubleToStr(WinPer, 1));
string Comment10 = "[OrderComment]";
string Comment11 = _Comment;
CommentLabel("ComObj0", Comment0, 4, 38, 10, clrYellow);
CommentLabel("ComObj1", Comment1, 4, 58, 10, clrYellow);
CommentLabel("ComObj2", Comment2, 6, 82, 8, clrChartWar);
CommentLabel("ComObj3", Comment3, 6, 100, 8, clrChartWar);
CommentLabel("ComObj4", Comment4, 6, 118, 8, clrChartWar);
CommentLabel("ComObj5", Comment5, 6, 136, 8, clrChartWar);
CommentLabel("ComObj6", Comment6, 6, 154, 8, clrChartWar);
CommentLabel("ComObj7", Comment7, 6, 172, 8, clrChartWarPP);
CommentLabel("ComObj8", Comment8, 6, 190, 8, clrChartWarPF);
CommentLabel("ComObj9", Comment9, 6, 208, 8, clrChartWar);
CommentLabel("ComObj10", Comment10, 6, 226, 8, clrChartWarCom);
CommentLabel("ComObj11", Comment11, 6, 248, 6, clrChartWar);
}
//+------------------------------------------------------------------+
void CommentLabel(string ComName, string ComText, int ComPos_x, int ComPos_y, int ComSize, color ComClr= clrBlack)
{
ComName = ComName;
ObjectCreate(ComName, OBJ_LABEL, 0, 0, 0);
ObjectSetString (0, ComName, OBJPROP_TEXT, ComText);
ObjectSetInteger(0, ComName, OBJPROP_XDISTANCE, ComPos_x);
ObjectSetInteger(0, ComName, OBJPROP_YDISTANCE, ComPos_y);
ObjectSetInteger(0, ComName, OBJPROP_FONTSIZE, ComSize);
ObjectSetInteger(0, ComName, OBJPROP_COLOR, ComClr);
ObjectSetString (0, ComName, OBJPROP_FONT, "Segoe UI");
ObjectSetInteger(0, ComName, OBJPROP_BACK, true);
ObjectSetInteger(0, ComName, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, ComName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, ComName, OBJPROP_ANCHOR, ANCHOR_RIGHT_UPPER);
}
//+------------------------------------------------------------------+
//<00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0%R-<2D><>[(u
//+------------------------------------------------------------------+
//| <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h<30>:y |
//+------------------------------------------------------------------+
void ChartComment()
{
color clrChartWar = ChartWarning >= 2? clrNONE : clrWhite;
color clrChartWarPP = ChartWarning >= 2? clrNONE : totalpips < 0? clrOrangeRed : clrWhite;
color clrChartWarPF = ChartWarning >= 2? clrNONE : 0 < ProfitFactor && ProfitFactor < 1? clrOrangeRed : clrWhite;
string LotsComment;
if (MM_ON == Fixed) LotsComment = DoubleToStr(Lots,2);
else LotsComment = DoubleToStr(CalculateLots(MM_Risk, StopLoss_pips),2) +
" (" + DoubleToStr(MM_Risk,1) +"%)";
string Comment0 = "Magic : " + (string)MagicNumber;
string Comment1 = "Lots : " + LotsComment;
string Comment2 = "MM : " + (MM_ON == 0 ? "Fixed" : MM_ON == 1 ? "FreeMargin" : MM_ON == 2 ? "Balance" : "AddCredit");
string Comment3 = "Summertime : " + (Summertime == 0 ? "none" : Summertime == 1 ? "US" : "UK");
string Comment4 = "Slippage log : " + (string)Measurement;
string Comment5 = "Spread Lim/Ave : " + DoubleToStr(MaxSpread_pips,1) + "/" + DoubleToStr(SpreadAve,1);
string Comment6 = "Profit (pips) : " + DoubleToStr(totalpips, 1);
string Comment7 = (plus_profit == 0 || minus_profit == 0? "Profit factor : ---" : "Profit factor : " + DoubleToStr(ProfitFactor, 2));
string Comment8 = "------------------------------";
string Comment9 = "Logic_Buy1: " + (string)Logic_Buy1;
string Comment10 = "TP/SL: " + DoubleToStr(TakeProfit_pips_Buy1,0) + "/" + DoubleToStr(StopLoss_pips_Buy1,0);
string Comment11 = "Modify: " + (string)Modify_Buy1;
string Comment12 = "Logic_Buy2: " + (string)Logic_Buy2;
string Comment13 = "TP/SL: " + DoubleToStr(TakeProfit_pips_Buy1,0) + "/" + DoubleToStr(StopLoss_pips_Buy1,0);
string Comment14 = "Logic_Sell1: " + (string)Logic_Sell1;
string Comment15 = "TP/SL: " + DoubleToStr(TakeProfit_pips_Sell1,0) + "/" + DoubleToStr(StopLoss_pips_Sell1,0);
string Comment16 = "Logic_Sell2: " + (string)Logic_Sell2;
string Comment17 = "TP/SL: " + DoubleToStr(TakeProfit_pips_Sell2,0) + "/" + DoubleToStr(StopLoss_pips_Sell2,0);
string Comment18 = "------------------------------";
CommentLabel("ComObj0", Comment0, 4, 38, 10, clrYellow);
CommentLabel("ComObj1", Comment1, 4, 58, 10, clrYellow);
CommentLabel("ComObj2", Comment2, 6, 82, 8, clrChartWar);
CommentLabel("ComObj3", Comment3, 6, 100, 8, clrChartWar);
CommentLabel("ComObj4", Comment4, 6, 118, 8, clrChartWar);
CommentLabel("ComObj5", Comment5, 6, 136, 8, clrChartWar);
CommentLabel("ComObj6", Comment6, 6, 154, 8, clrChartWarPP);
CommentLabel("ComObj7", Comment7, 6, 172, 8, clrChartWarPF);
CommentLabel("ComObj8", Comment8, 6, 186, 8, clrChartWar);
CommentLabel("ComObj9", Comment9, 6, 200, 8, clrChartWar);
CommentLabel("ComObj10", Comment10, 6, 218, 8, clrChartWar);
CommentLabel("ComObj11", Comment11, 6, 236, 8, clrChartWar);
CommentLabel("ComObj12", Comment12, 6, 254, 8, clrChartWar);
CommentLabel("ComObj13", Comment13, 6, 272, 8, clrChartWar);
CommentLabel("ComObj14", Comment14, 6, 290, 8, clrChartWar);
CommentLabel("ComObj15", Comment15, 6, 308, 8, clrChartWar);
CommentLabel("ComObj16", Comment16, 6, 326, 8, clrChartWar);
CommentLabel("ComObj17", Comment17, 6, 344, 8, clrChartWar);
CommentLabel("ComObj18", Comment18, 6, 358, 8, clrChartWar);
}
// <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0n0<6E>N<EFBFBD>i
void CommentLabel(string ComName, string ComText, int ComPos_x, int ComPos_y, int ComSize, color ComClr= clrBlack)
{
ObjectCreate(ComName, OBJ_LABEL, 0, 0, 0);
ObjectSetString (0, ComName, OBJPROP_TEXT, ComText);
ObjectSetInteger(0, ComName, OBJPROP_XDISTANCE, ComPos_x);
ObjectSetInteger(0, ComName, OBJPROP_YDISTANCE, ComPos_y);
ObjectSetInteger(0, ComName, OBJPROP_FONTSIZE, ComSize);
ObjectSetInteger(0, ComName, OBJPROP_COLOR, ComClr);
ObjectSetString (0, ComName, OBJPROP_FONT, "Segoe UI");
ObjectSetInteger(0, ComName, OBJPROP_BACK, true);
ObjectSetInteger(0, ComName, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, ComName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, ComName, OBJPROP_ANCHOR, ANCHOR_RIGHT_UPPER);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| <00>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h<30>:y |
//+------------------------------------------------------------------+
void ChartComment()
{
string LotsComment;
if (MM_ON == Fixed) LotsComment = DoubleToStr(Lots,2);
else LotsComment = DoubleToStr(CalculateLots(MM_Risk, StopLoss_pips),2) +
" (" + DoubleToStr(MM_Risk,1) +"%)";
string Comment0 = "Magic : " + (string)MagicNumber;
string Comment1 = "Lots : " + LotsComment;
string Comment2 = "MM : " + (MM_ON == 0 ? "Fixed" : MM_ON == 1 ? "FreeMargin" : MM_ON == 2 ? "Balance" : "AddCredit");
string Comment3 = "Summertime : " + (Summertime == 0 ? "none" : Summertime == 1 ? "US" : "UK");
string Comment4 = "Spread Limit/Ave : " + DoubleToStr(MaxSpread_pips,1) + "/" + DoubleToStr(SpreadAve,1);
string Comment5 = "Stoploss B/S : " + DoubleToStr(StopLoss_pips_buy, 0) + "/" + DoubleToStr(StopLoss_pips_sell, 0);
string Comment6 = "Swap B/S : " + DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG), 2) + "/" +
DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT), 2);
CommentLabel("ComObj0", Comment0, 4, 38, 10, clrYellow);
CommentLabel("ComObj1", Comment1, 4, 58, 10, clrYellow);
CommentLabel("ComObj2", Comment2, 6, 82, 8, clrWhite);
CommentLabel("ComObj3", Comment3, 6, 100, 8, clrWhite);
CommentLabel("ComObj4", Comment4, 6, 118, 8, clrWhite);
CommentLabel("ComObj5", Comment5, 6, 172, 8, clrWhite);
CommentLabel("ComObj6", Comment6, 6, 190, 8, clrWhite);
}
//+------------------------------------------------------------------+
void CommentLabel(string ComName, string ComText, int ComPos_x, int ComPos_y, int ComSize, color ComClr= clrBlack)
{
ComName = ComName;
ObjectCreate(ComName, OBJ_LABEL, 0, 0, 0);
ObjectSetString (0, ComName, OBJPROP_TEXT, ComText);
ObjectSetInteger(0, ComName, OBJPROP_XDISTANCE, ComPos_x);
ObjectSetInteger(0, ComName, OBJPROP_YDISTANCE, ComPos_y);
ObjectSetInteger(0, ComName, OBJPROP_FONTSIZE, ComSize);
ObjectSetInteger(0, ComName, OBJPROP_COLOR, ComClr);
ObjectSetString (0, ComName, OBJPROP_FONT, "Segoe UI");
ObjectSetInteger(0, ComName, OBJPROP_BACK, true);
ObjectSetInteger(0, ComName, OBJPROP_SELECTABLE, false);
ObjectSetInteger(0, ComName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, ComName, OBJPROP_ANCHOR, ANCHOR_RIGHT_UPPER);
}
//+------------------------------------------------------------------+