Interesting. The only place where this could happen is "/ AccountMargin()".
Either your AccountMargin=0 or this is not the piece of code giving the problem.
PS: Just noticed the name of the EA - PipMaker, a Martingale. So this is the right piece of code, and your AccountMargin is guaranteed to go to zero. Case closed.
If its any consolation to you, jjc and I both have on occasions discovered some of the functions - like AccountMargin(), AccountFreeMarginCheck() - erroneously return zero.
CB
Hi,
As I said the program seems to run just fine, though it needs to be modified to make this profitable (close out obvious losers very early). I had decided to wait for MQL5 before getting into this but have some MQL4 EAs that I want to 'fix'. So I'm ending up 'stumbling my way' into MQL4 programming' after all.
I'm fumbling my way around putting a S/L into a later version of this (switchable) Martingale scalper which will change these 'PipMakers' into very profitable EAs. Utilizing this approach of working with an established program which forces me to learn how, why, what the MQL4 functions in an existing working MQL4 program is already doing successfully and then figuring out what to do to achieve what I want will be more feasible to me in this case. As opposed to having to write a complete (working!) MQL4 program from scratch as I am starting with a program that is already complete, functions properly and works well.
I tend to be 'self taught' in many different areas.
Thanks to both of you for the info, assistance, tips and feedback.
. . . . . . . . . . . . . . . . . . (8 >) . Prosperous Trading . (< 8)
Regards,
DougRH4x
Yep, in the pure Martingale mode if left to run strictly as a Martingale EA the losses will inevitably end up completely draining the account. However this one has a number of settings, adjustments and options so that it doesn't only run strictly as a pure Martingale. Depending on the settings, it does generate a LOT of successful, profitable trades. I have managed to get the settings in this EA as it stands so that it has a very high percentage of profitable trades and only very rarely makes a losing trade. I would say that classifying this is as a 'Martingale Scalper' would be a more apt description of it. I'm going to modify it so that it closes out the losing trades very early rather than just letting them keep digging there way into a deeper and deeper hole until...... In spite of the valid conclusion that an EA that is strictly a Martingale EA, this one does have the potential to be a winner. Also, as with many EAs the author of this one stresses the importance of optimizing it, which is most definitely a necessity for PipMaker. It is too bad that the back tester & optimization aspects in the MT4 Terminal is so inaccurate that it is basically useless. Perhaps they will do better with the forthcoming MT/MQL5, though I have my doubts. I’m wondering if there aren’t more accurate ForEx back testers and Optimization utilities around?
This will be an 'interesting' process for me as I know pretty well zilch about programming. However I did take RubberBands and in a short period of time managed to make it more profitable just by utilizing the concepts that are for the most part fairly obvious as to what most of the functions are doing. Though I’m most defiantly nowhere near being at a point where I could just sit down and whip up a efficient, working and profitable EA in short order. I’m not so foolish as to think that I will even be able to quickly, easily and accurately modify an existing EA as obviously I have to know what and how it is doing things first. However I am fairly confident that I can and will make quite a schmozel out of what initially was a well coded EA in fairly short order though LoL (< 8)
Once more unto thy breach … . .
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
This runs OK, but in the experts tab of the terminal, there is a continuous stream of 'Divide by Zero' errors.
Thanks to one and all for any assistance with this (< 8)
//+--------------------------------------------------+
//|PipMaker v5 Neo Last Update 06-27-2007 01:05am |
//+--------------------------------------------------+
#include <stdlib.mqh>
#include <stderror.mqh>
#define NL "\n"
// Regular variables
extern double LotSize = 0.1; //0.01;
extern double LotIncrement = 0.1; //0.01;
//extern bool Multiplier = true;
extern int Multiplier = 0;
extern int ProfitTarget = 5; //50;
//extern bool OpenOnTick = false;
extern int OpenOnTick = 0;
extern int Spacing = 2;
extern int TrendSpacing = 1;
extern double CounterTrendMultiplier = 2;
extern double CloseDelay = 0; //91;
extern int TrendTimeFrame = PERIOD_M1;
extern int TrendPeriods = 1200;
extern bool CeaseTrading = false;
extern bool RightSideLabel = true;
// Internal settings
int Step = 1;
int Error = 1; //= 0;
int Order = 1; //= 0;
int Slippage = 1; //= 0;
int Reference = 1; //= 0;
string TradeComment = "PipMakerV5neo_DRH1";
datetime BarTime = 0;
static bool TradeAllowed = true;
double TickPrice = 0;
int MaxBuys = 3; //0;
int MaxSells = 3; //0;
bool Auditing = true;
string Filename = "PipMaker_v5_Neo.txt";
int init()
{
if (Symbol() == "AUDCADm" || Symbol() == "AUDCAD") Reference = 801001;
if (Symbol() == "AUDJPYm" || Symbol() == "AUDJPY") Reference = 801002;
if (Symbol() == "AUDNZDm" || Symbol() == "AUDNZD") Reference = 801003;
if (Symbol() == "AUDUSDm" || Symbol() == "AUDUSD") Reference = 801004;
if (Symbol() == "CHFJPYm" || Symbol() == "CHFJPY") Reference = 801005;
if (Symbol() == "EURAUDm" || Symbol() == "EURAUD") Reference = 801006;
if (Symbol() == "EURCADm" || Symbol() == "EURCAD") Reference = 801007;
if (Symbol() == "EURCHFm" || Symbol() == "EURCHF") Reference = 801008;
if (Symbol() == "EURGBPm" || Symbol() == "EURGBP") Reference = 801009;
if (Symbol() == "EURJPYm" || Symbol() == "EURJPY") Reference = 801010;
if (Symbol() == "EURUSDm" || Symbol() == "EURUSD") Reference = 801011;
if (Symbol() == "GBPCHFm" || Symbol() == "GBPCHF") Reference = 801012;
if (Symbol() == "GBPJPYm" || Symbol() == "GBPJPY") Reference = 801013;
if (Symbol() == "GBPUSDm" || Symbol() == "GBPUSD") Reference = 801014;
if (Symbol() == "NZDJPYm" || Symbol() == "NZDJPY") Reference = 801015;
if (Symbol() == "NZDUSDm" || Symbol() == "NZDUSD") Reference = 801016;
if (Symbol() == "USDCHFm" || Symbol() == "USDCHF") Reference = 801017;
if (Symbol() == "USDJPYm" || Symbol() == "USDJPY") Reference = 801018;
if (Symbol() == "USDCADm" || Symbol() == "USDCAD") Reference = 801019;
if (Reference == 0) Reference = 801999;
}
int deinit()
{
}
void CloseBuysInProfit()
{
double BuyProfit, LastBuyTime;
RefreshRates();
for (Order = OrdersTotal() - 1; Order >= 0; Order--)
{
if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_BUY)
{
BuyProfit = OrderProfit() + OrderSwap() + OrderCommission();
if (OrderOpenTime() > LastBuyTime) LastBuyTime = OrderOpenTime();
if ((IsTesting() || TimeCurrent() - LastBuyTime >= CloseDelay) && BuyProfit > 0) OrderClose(OrderTicket(), OrderLots(), Bid, 5, Green);
Error = GetLastError();
if (Error != 0) Write("Error closing BUY order " + OrderTicket() + ": " + ErrorDescription(Error) + " (A" + Error + ") Lots:" + OrderLots() + " Bid:" + MarketInfo(OrderSymbol(), MODE_BID));
}
}
}
return;
}
void CloseSellsInProfit()
{
double SellProfit, LastSellTime;
RefreshRates();
for (Order = OrdersTotal() - 1; Order >= 0; Order--)
{
if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_SELL)
{
SellProfit = OrderProfit() + OrderSwap() + OrderCommission();
if (OrderOpenTime() > LastSellTime) LastSellTime = OrderOpenTime();
if ((IsTesting() || TimeCurrent() - LastSellTime >= CloseDelay) && SellProfit > 0) OrderClose(OrderTicket(), OrderLots(), Ask, 5, Red);
Error = GetLastError();
if (Error != 0) Write("Error closing SELL order " + OrderTicket() + ": " + ErrorDescription(Error) + " (B" + Error + ") Lots:" + OrderLots() + " Ask:" + MarketInfo(OrderSymbol(), MODE_ASK));
}
}
}
return;
}
void PlaceBuyOrder()
{
double BuyOrders, Lots;
double LowestBuy = 1000, HighestBuy;
if (BarTime != Time[0])
{
BarTime = Time[0];
TickPrice = 0;
TradeAllowed = true;
}
RefreshRates();
for (Order = OrdersTotal() - 1; Order >= 0; Order--)
{
if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_BUY)
{
if (OrderOpenPrice() < LowestBuy) LowestBuy = OrderOpenPrice();
if (OrderOpenPrice() > HighestBuy) HighestBuy = OrderOpenPrice();
BuyOrders++;
}
}
}
if (TradeAllowed)
{
if (Ask >= HighestBuy + (TrendSpacing * Point))
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize * MathPow(LotIncrement, BuyOrders), 2);
else
Lots = NormalizeDouble(LotSize + (LotIncrement * BuyOrders), 2);
}
if (Ask <= LowestBuy - (Spacing * Point))
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize * CounterTrendMultiplier * MathPow(LotIncrement, BuyOrders), 2);
else
Lots = NormalizeDouble((LotSize * CounterTrendMultiplier) + (LotIncrement * BuyOrders), 2);
}
if (Lots == 0)
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize, 2);
else
Lots = NormalizeDouble(LotSize, 2);
}
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, TradeComment, Reference, Green);
Error = GetLastError();
if (Error != 0)
Write("Error opening BUY order: " + ErrorDescription(Error) + " (C" + Error + ") Ask:" + Ask + " Slippage:" + Slippage);
else
{
TickPrice = Close[0];
TradeAllowed = false;
}
}
}
void PlaceSellOrder()
{
double SellOrders, Lots;
double HighestSell, LowestSell = 1000;
if (BarTime != Time[0])
{
BarTime = Time[0];
TickPrice = 0;
TradeAllowed = true;
}
RefreshRates();
for (Order = OrdersTotal() - 1; Order >= 0; Order--)
{
if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference && OrderType() == OP_SELL)
{
if (OrderOpenPrice() > HighestSell) HighestSell = OrderOpenPrice();
if (OrderOpenPrice() < LowestSell) LowestSell = OrderOpenPrice();
SellOrders++;
}
}
}
if (TradeAllowed)
{
if (Bid <= LowestSell - (TrendSpacing * Point))
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize * MathPow(LotIncrement, SellOrders), 2);
else
Lots = NormalizeDouble(LotSize + (LotIncrement * SellOrders), 2);
}
if (Bid >= HighestSell + (Spacing * Point))
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize * CounterTrendMultiplier * MathPow(LotIncrement, SellOrders), 2);
else
Lots = NormalizeDouble((LotSize * CounterTrendMultiplier) + (LotIncrement * SellOrders), 2);
}
if (Lots == 0)
{
// if (Multiplier)
if (Multiplier == 1)
Lots = NormalizeDouble(LotSize, 2);
else
Lots = NormalizeDouble(LotSize, 2);
}
OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, TradeComment, Reference, Red);
Error = GetLastError();
if (Error != 0)
Write("Error opening SELL order: " + ErrorDescription(Error) + " (D" + Error + ") Bid:" + Bid + " Slippage:" + Slippage);
else
{
TickPrice = Close[0];
TradeAllowed = false;
}
}
}
int start()
{
double MarginPercent;
static double LowMarginPercent = 10000000, LowEquity = 10000000;
double BuyPipTarget, SellPipTarget;
int SellOrders, BuyOrders;
double BuyPips, SellPips, BuyLots, SellLots;
double LowestBuy = 999, HighestBuy = 0.0001, LowestSell = 999, HighestSell = 0.0001, HighPoint, MidPoint, LowPoint;
double Profit = 0, BuyProfit = 0, SellProfit = 0, PosBuyProfit = 0, PosSellProfit = 0;
int HighestBuyTicket, LowestBuyTicket, HighestSellTicket, LowestSellTicket;
double HighestBuyProfit, LowestBuyProfit, HighestSellProfit, LowestSellProfit;
double CurrentTime = (TimeHour(CurTime() + TimeMinute(CurTime())));
double Trend;
bool SELLme = false;
bool BUYme = false;
double Margin = MarketInfo(Symbol(), MODE_MARGINREQUIRED);
string Message;
for (Order = OrdersTotal() - 1; Order >= 0; Order--)
{
if (OrderSelect(Order, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Reference)
{
Profit = OrderProfit() + OrderSwap() + OrderCommission();
if (OrderType() == OP_BUY)
{
if (OrderOpenPrice() >= HighestBuy)
{
HighestBuy = OrderOpenPrice();
HighestBuyTicket = OrderTicket();
HighestBuyProfit = Profit;
}
if (OrderOpenPrice() <= LowestBuy)
{
LowestBuy = OrderOpenPrice();
LowestBuyTicket = OrderTicket();
LowestBuyProfit = Profit;
}
BuyOrders++;
if (BuyOrders > MaxBuys) MaxBuys = BuyOrders;
BuyLots += OrderLots();
BuyProfit += Profit;
if (Profit > 0) PosBuyProfit += Profit;
}
if (OrderType() == OP_SELL)
{
if (OrderOpenPrice() <= LowestSell)
{
LowestSell = OrderOpenPrice();
LowestSellTicket = OrderTicket();
LowestSellProfit = Profit;
}
if (OrderOpenPrice() >= HighestSell)
{
HighestSell = OrderOpenPrice();
HighestSellTicket = OrderTicket();
HighestSellProfit = Profit;
}
SellOrders++;
if (SellOrders > MaxSells) MaxSells = SellOrders;
SellLots += OrderLots();
SellProfit += Profit;
if (Profit > 0) PosSellProfit += Profit;
}
}
}
}
BuyPipTarget = ProfitTarget;
SellPipTarget = ProfitTarget;
if (HighestBuy >= HighestSell)
HighPoint = HighestBuy;
else
HighPoint = HighestSell;
if (LowestBuy <= LowestSell)
LowPoint = LowestBuy;
else
LowPoint = LowestSell;
MidPoint = (HighPoint + LowPoint) / 2;
// if ((SellOrders > 1 && BuyOrders > 0) || (SellOrders > 0 && BuyOrders > 1)) MidPoint = (HighPoint + LowPoint) / 2;
RefreshRates();
if (Ask > MidPoint)
{
if (PosBuyProfit + LowestSellProfit >= ProfitTarget && LowestSell < LowestBuy)
{
OrderSelect(LowestSellTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing SELL order " + LowestSellTicket + ": " + ErrorDescription(Error) + " (E" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Ask, 5, Green);
Error = GetLastError();
if (Error != 0) Write("Error closing SELL order " + OrderTicket() + ": " + ErrorDescription(Error) + " (F" + Error + ") Lots:" + OrderLots() + " Ask:" + MarketInfo(OrderSymbol(), MODE_ASK));
CloseBuysInProfit();
LowestBuy = 1000;
HighestBuy = 0;
LowestSell = 1000;
LowestSellTicket = 0;
}
else if (PosSellProfit + LowestSellProfit >= ProfitTarget && LowestSell < LowestBuy)
{
OrderSelect(LowestSellTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing SELL order " + LowestSellTicket + ": " + ErrorDescription(Error) + " (G" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Ask, 5, Red);
Error = GetLastError();
if (Error != 0) Write("Error closing SELL order " + OrderTicket() + ": " + ErrorDescription(Error) + " (H" + Error + ") Lots:" + OrderLots() + " Ask:" + MarketInfo(OrderSymbol(), MODE_ASK));
CloseSellsInProfit();
LowestSell = 1000;
HighestSell = 0;
LowestSellTicket = 0;
}
else if (PosBuyProfit + LowestBuyProfit >= ProfitTarget && LowestBuy < LowestSell)
{
OrderSelect(LowestBuyTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing BUY order " + LowestBuyTicket + ": " + ErrorDescription(Error) + " (I" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Bid, 5, Green);
Error = GetLastError();
if (Error != 0) Write("Error closing BUY order " + OrderTicket() + ": " + ErrorDescription(Error) + " (J" + Error + ") Lots:" + OrderLots() + " Bid:" + MarketInfo(OrderSymbol(), MODE_BID));
CloseBuysInProfit();
LowestBuy = 1000;
HighestBuy = 0;
LowestBuyTicket = 0;
}
else if (PosSellProfit + LowestBuyProfit >= ProfitTarget && LowestBuy < LowestSell)
{
OrderSelect(LowestBuyTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing BUY order " + LowestBuyTicket + ": " + ErrorDescription(Error) + " (K" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Bid, 5, Red);
Error = GetLastError();
if (Error != 0) Write("Error closing BUY order " + OrderTicket() + ": " + ErrorDescription(Error) + " (L" + Error + ") Lots:" + OrderLots() + " Bid:" + MarketInfo(OrderSymbol(), MODE_BID));
CloseSellsInProfit();
LowestSell = 1000;
HighestSell = 0;
LowestBuy = 1000;
LowestBuyTicket = 0;
}
}
else if (Bid < MidPoint)
{
if (PosBuyProfit + HighestBuyProfit >= ProfitTarget && HighestBuy > HighestSell)
{
OrderSelect(HighestBuyTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing BUY order " + HighestBuyTicket + ": " + ErrorDescription(Error) + " (M" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Bid, 5, Green);
Error = GetLastError();
if (Error != 0) Write("Error closing BUY order " + OrderTicket() + ": " + ErrorDescription(Error) + " (N" + Error + ") Lots:" + OrderLots() + " Bid:" + MarketInfo(OrderSymbol(), MODE_BID));
CloseBuysInProfit();
LowestBuy = 1000;
HighestBuy = 0;
HighestBuyTicket = 0;
}
else if (PosSellProfit + HighestBuyProfit >= ProfitTarget && HighestBuy > HighestSell)
{
OrderSelect(HighestBuyTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing BUY order " + HighestBuyTicket + ": " + ErrorDescription(Error) + " (O" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Bid, 5, Red);
Error = GetLastError();
if (Error != 0) Write("Error closing BUY order " + OrderTicket() + ": " + ErrorDescription(Error) + " (P" + Error + ") Lots:" + OrderLots() + " Bid:" + MarketInfo(OrderSymbol(), MODE_BID));
CloseSellsInProfit();
LowestSell = 1000;
HighestSell = 0;
HighestBuy = 0;
HighestBuyTicket = 0;
}
else if (PosBuyProfit + HighestSellProfit >= ProfitTarget && HighestSell > HighestBuy)
{
OrderSelect(HighestSellTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing SELL order " + HighestSellTicket + ": " + ErrorDescription(Error) + " (Q" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Ask, 5, Green);
Error = GetLastError();
if (Error != 0) Write("Error closing SELL order " + OrderTicket() + ": " + ErrorDescription(Error) + " (R" + Error + ") Lots:" + OrderLots() + " Ask:" + MarketInfo(OrderSymbol(), MODE_ASK));
CloseBuysInProfit();
LowestBuy = 1000;
HighestBuy = 0;
HighestSell = 0;
HighestSellTicket = 0;
}
else if (PosSellProfit + HighestSellProfit >= ProfitTarget && HighestSell > HighestBuy)
{
OrderSelect(HighestSellTicket, SELECT_BY_TICKET);
Error = GetLastError();
if (Error != 0) Write("Error accessing SELL order " + HighestSellTicket + ": " + ErrorDescription(Error) + " (S" + Error + ")");
OrderClose(OrderTicket(), OrderLots(), Ask, 5, Red);
Error = GetLastError();
if (Error != 0) Write("Error closing SELL order " + OrderTicket() + ": " + ErrorDescription(Error) + " (T" + Error + ") Lots:" + OrderLots() + " Ask:" + MarketInfo(OrderSymbol(), MODE_ASK));
CloseSellsInProfit();
LowestSell = 1000;
HighestSell = 0;
HighestSellTicket = 0;
}
}
RefreshRates();
Trend = iMA(Symbol(), TrendTimeFrame, TrendPeriods, 0, MODE_LWMA, PRICE_CLOSE, 0);
// PrevTrend = iMACD(Symbol(), PERIOD_M1, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
// BUY Trade Criteria
if (HighestBuy > 0 && LowestBuy < 1000)
{
if (Ask <= LowestBuy - (Spacing * Point) || Ask >= HighestBuy + (TrendSpacing * Point))
{
BUYme = true;
// if (OpenOnTick && TickPrice > 0 && Close[0] < TickPrice) TradeAllowed = true;
if (OpenOnTick == 1 && TickPrice > 0 && Close[0] < TickPrice) TradeAllowed = true;
}
if (CeaseTrading && BuyOrders == 0) BUYme = false;
if (Ask < Trend) BUYme = false;
if (BUYme) PlaceBuyOrder();
}
// SELL Trade Criteria
if (HighestSell > 0 && LowestSell < 1000)
{
if (Bid >= HighestSell + (Spacing * Point) || Bid <= LowestSell - (TrendSpacing * Point))
{
SELLme = true;
// if (OpenOnTick && TickPrice > 0 && Close[0] > TickPrice) TradeAllowed = true;
if (OpenOnTick == 1 && TickPrice > 0 && Close[0] > TickPrice) TradeAllowed = true;
}
if (CeaseTrading && SellOrders == 0) SELLme = false;
if (Bid > Trend) SELLme = false;
if (SELLme) PlaceSellOrder();
}
MarginPercent = MathRound((AccountEquity() / AccountMargin()) * 100);
if (LowMarginPercent > MarginPercent) LowMarginPercent = MarginPercent;
if (AccountEquity() < LowEquity) LowEquity = AccountEquity();
Message = " PipMaker v5 Neo" + NL +
" ProfitTarget " + DoubleToStr(BuyPipTarget, 2) + NL +
" Buys " + BuyOrders + " Highest: " + MaxBuys + NL +
" BuyLots " + DoubleToStr(BuyLots, 2) + NL +
" BuyProfit " + DoubleToStr(BuyProfit, 2) + NL +
" Highest Buy " + DoubleToStr(HighestBuy, Digits) + " #" + DoubleToStr(HighestBuyTicket, 0) + " Profit: " + DoubleToStr(HighestBuyProfit, 2) + NL +
" Highest Sell " + DoubleToStr(HighestSell, Digits) + " #" + DoubleToStr(HighestSellTicket, 0) + " Profit: " + DoubleToStr(HighestSellProfit, 2) + NL + NL +
" ProfitTarget " + DoubleToStr(SellPipTarget, 2) + NL +
" Sells " + SellOrders + " Highest: " + MaxSells + NL +
" SellLots " + DoubleToStr(SellLots, 2) + NL +
" SellProfit " + DoubleToStr(SellProfit, 2) + NL +
" Lowest Buy " + DoubleToStr(LowestBuy, Digits) + " #" + DoubleToStr(LowestBuyTicket, 0) + " Profit: " + DoubleToStr(LowestBuyProfit, 2) + NL +
" Lowest Sell " + DoubleToStr(LowestSell, Digits) + " #" + DoubleToStr(LowestSellTicket, 0) + " Profit: " + DoubleToStr(LowestSellProfit, 2) + NL + NL +
" Balance " + DoubleToStr(AccountBalance(), 2) + NL +
" Equity " + DoubleToStr(AccountEquity(), 2) + " Lowest: " + DoubleToStr(LowEquity, 2) + NL + NL +
" Margin " + DoubleToStr(AccountMargin(), 2) + NL +
" MarginPercent " + DoubleToStr(MarginPercent, 2) + NL +
" LowMarginPercent " + DoubleToStr(LowMarginPercent, 2) + NL +
" Current Time is " + TimeToStr(TimeCurrent(), TIME_SECONDS);
Comment(Message);
if (RightSideLabel)
{
string MarPercent = DoubleToStr(MarginPercent, 0);
string LowMarPercent = DoubleToStr(LowMarginPercent, 0);
string AcctBalance = DoubleToStr(AccountBalance(), 0);
ObjectDelete("MarginPercent");
if (ObjectFind("MarginPercent") != 0)
{
ObjectCreate("MarginPercent", OBJ_TEXT, 0, Time[0], Close[0]);
ObjectSetText("MarginPercent", MarPercent + "% " + LowMarPercent + "% $" + AcctBalance, 24, "Arial", White);
}
else
{
ObjectMove("MarginPercent", 0, Time[0], Close[0]);
}
}
if (ObjectFind("MidPoint") != 0)
{
ObjectCreate("MidPoint", OBJ_HLINE, 0, Time[0], MidPoint);
ObjectSet("MidPoint", OBJPROP_COLOR, Blue);
ObjectSet("MidPoint", OBJPROP_WIDTH, 2);
}
else
{
}
}