Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 265

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Is the graph in the browser or where?
No, the graph in the terminal
By the way, I remembered about calling external commands, can you tell me how to tell the browser (and if it's possible):
"open http://bla-bla-bla page, and if it already exists, just show the corresponding tab".
ShellExecuteW(0, "Open"....) is used to open a new tab every time
Do you always buy cucumbers of the same quality for 50 when they are 10 next to each other?
every once in a while)
you know the first rule of trading - trend is your friend ?
History repeats itself - Up - down Up - down. Hence, up sell, down buy
Thank you, it all worked out.
every once in a while)
You know the first rule of trading - trend is your friend?
Who doesn't, but when the cucumber warehouse is full to the brim (the end of the cucumber trend) and it's time to sell the cucumbers to make room in the warehouse, I won't buy another batch of cucumbers. I'll sell a batch or two first, so as not to put boxes on the roof of the warehouse which will rot out or be mercilessly stolen or eaten by crows.
And "on top" for me is when you can see the level of the warehouse roof, below you can see the level of its floor...
So there you go...
every once in a while)
You know the first rule of trading - trend is your friend?
This rule only applies if you are a market maker or at least a DC and are aware of its formation and development. From the point of view of a normal trader, the trend is the meanest and most treacherous animal that can exist on this market.
Because it is 100% determined only on completion ))))
You don't need any enemies with such friends...every once in a while)
you know the first rule of trading - trend is your friend ?
It's not the first rule. The first is buy low, sell high.
And up or down, trending or counter-trending is not a rule, but a personal predilection.
Artyom good afternoon. My name is Daniel. My question is the following one. I have written my Expert Advisor in MQL4, to be more precise, I have rewritten it from the video tutorial. Apparently there are some errors, but it does not compile well.
//+------------------------------------------------------------------+
//| test7.mq4 |
//| Copyright 2017, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//-------------------------------------------------------------------
extern double lots = 0.1;
extern int TakeProfit = 300;
extern int StopLoss = 50;
extern int Magic = 777;
extern inttern Slippage = 3;
//-------------------------------------------------------------------
extern string TMA = "TMA indicator parameters";
extern string TimeFrame = "current time frame";
extern int HalfLength = 56;
extern int Price = "PRICE_CLOSE;
extern double ATRMultiplier = 2.0;
extern inttern ATRPeriod = 100;
extern bool Interpolate = true;
//-------------------------------------------------------------------
double PriceHigh, PriceLow, SL , TP;
int ticet;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
if (Digits == 3 || Digits == 5);
{
TakeProfit *=10;
StopLoss *=10;
Slippage *=10;
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
PriceHigh = iCustom(NULL, 0, "TMA_Fair", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 1, 0);
PriceLow = iCustom(NULL, 0, "TMA_Fair", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 2, 0);
if (CountSell() == 0 && Bid >= PriceHigh)
{
tiket = OrderSend(Symbol(), OP_SELL, lots, Bid, Slippage, 0, 0, "TMA robot", Magic, 0, Red);
if (tiket > 0)
{
SL = NormalizeDouble(Bid + StopLoss*Point, Digits);
TP = NormalizeDouble(Bid - TakeProfit*Point, Digits);
if (OrderSelect(tiket, SELECT_BY_TICKET))
OrderModify(tiket, OrderOpenPrice(), SL, TP, 0)
}
}
}
//--------------------------------------------------------------------------------------------
if (CountBuy() == 0 && Ask <= PriceLow)
{
tiket = OrderSend(Symbol(), OP_BUY, lots, Ask, Slippage, 0, 0, "TMA robot", Magic, 0, Blue);
if (tiket > 0)
{
TP = NormalizeDouble(Ask + TakeProfit*Point, Digits);
SL = NormalizeDouble(Ask - StopLoss*Point, Digits);
if (OrderSelect(tiket, SELECT_BY_TICKET))
OrderModify(tiket, OrderOpenPrice(), SL, TP, 0);
}
}
//+------------------------------------------------------------------+
int CountSell()
{
int count = 0;
for (int trade = OrdersTotal()-1; trade>=0; trade--)
{
if (OrderSelect(trade, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber) == Magic && OrderType() == OP_SELL)
count++;
}
}
return(count);
}
//-----------------------------------------------------------------------------------------------
int CountBuy()
{
int count = 0;
for (int trade = OrdersTotal()-1; trade>=0; trade--)
{
if (OrderSelect(trade, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber) == Magic && OrderType() == OP_BUY)
count++;
}
}
return(count);
}