MAKE THE FOLLOWING CHANGES TO OUR PREV CODES:
Inserted Code
void BUTTONS_PADDING()
{
avgPrice();
int x=x00;
int y=y00;
int xd=x99-x00;
int yd=y60-y00;
Create_Button("PAD_1","\n", x, y, xd, yd, FONT, clrBX, clrBX, clrBR, "PAD_1");
x=x01; y=y01; xd=x98-x01; yd=y59-y01;
Create_Button("PAD_2","\n", x, y, xd, yd, FONT, clrBX, clrBX, clrBR, "PAD_2");
x=x03; y=y03; xd=x17-x03; yd=y09-y03;
Create_Button("price_1","AVG", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x17; xd=x31-x17;
Create_Button("price_2","LOTS", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x31; xd=x45-x31;
Create_Button("price_3","P/L", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x45; xd=x59-x45;
Create_Button("price_4","ASK/BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x59; xd=x73-x59;
Create_Button("price_5","AVG B/S", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x73; xd=x87-x73;
Create_Button("price_6","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x87; xd=x97-x87;
Create_Button("price_7","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
y=y+yd;
x=x03; xd=x17-x03;
Create_Button("price_11",DoubleToString(avgB,1), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x17; xd=x31-x17;
Create_Button("price_12",DoubleToString(lotsB,2), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x31; xd=x45-x31;
Create_Button("price_13",DoubleToString(profitB,2), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x45; xd=x59-x45;
Create_Button("price_14",DoubleToString(sASK,_Digits), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x59; xd=x73-x59;
Create_Button("price_15",DoubleToString(bpAvg,_Digits+1), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x73; xd=x87-x73;
Create_Button("price_16","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x87; xd=x97-x87;
Create_Button("price_17","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
y=y+yd;
x=x03; xd=x17-x03;
Create_Button("price_21",DoubleToString(avgS,1), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x17; xd=x31-x17;
Create_Button("price_22",DoubleToString(lotsS,2), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x31; xd=x45-x31;
Create_Button("price_23",DoubleToString(profitS,2), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x45; xd=x59-x45;
Create_Button("price_24",DoubleToString(bBID,_Digits), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x59; xd=x73-x59;
Create_Button("price_25",DoubleToString(spAvg,_Digits+1), x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x73; xd=x87-x73;
Create_Button("price_26","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
x=x87; xd=x97-x87;
Create_Button("price_27","BID", x, y, xd, yd, FONT, clrBX, clrT, clrBR, "PAD_2");
}
double bpAvg;
double spAvg;
double bBID;
double sASK;
double avgB;
double avgS;
double profitB = 0;
double profitS = 0;
double lotsB = 0;
double lotsS = 0;
string symm=ChartSymbol(0);
void avgPrice()
{
profitB = 0;
profitS = 0;
lotsB = 0;
lotsS = 0;
avgB=0;
avgS=0;
for(int i=PositionsTotal()-1; i>=0; i--)
{
string sym=PositionGetSymbol(i);
if(sym==symm)
{
ENUM_POSITION_TYPE type=ENUM_POSITION_TYPE(PositionGetInteger(POSITION_TYPE));
if(type==POSITION_TYPE_BUY)
{
lotsB = lotsB + PositionGetDouble(POSITION_VOLUME);
profitB = profitB + PositionGetDouble(POSITION_PROFIT)+PositionGetDouble(POSITION_SWAP);
}
else if(type==POSITION_TYPE_SELL)
{
lotsS = lotsS + PositionGetDouble(POSITION_VOLUME);
profitS = profitS + PositionGetDouble(POSITION_PROFIT)+PositionGetDouble(POSITION_SWAP);
}
}
}
//Print(lotsS,"//S//",profitS);
//Print(lotsB,"//B//",profitB);
double PV=SymbolInfoDouble(symm,SYMBOL_TRADE_TICK_VALUE);
//Print(symm+"//PV//"+string(PV));
if((lotsB*PV)>0.0001) avgB=profitB/(lotsB*PV);
if((lotsS*PV)>0.0001) avgS=profitS/(lotsS*PV);
Print("////avgB=",DoubleToString(avgB,_Digits+1),"////avgS=",DoubleToString(avgS,_Digits+1));
bpAvg=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
spAvg=SymbolInfoDouble(Symbol(),SYMBOL_BID);
bBID=SymbolInfoDouble(Symbol(),SYMBOL_BID);
sASK=SymbolInfoDouble(Symbol(),SYMBOL_ASK);
bpAvg=sASK-avgB*_Point;
spAvg=bBID+avgS*_Point;
} each day 10%,,,, https://www.forexfactory.com/thread/1371538
1