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
Qestion for Coders
Hi
I wrote Alert but it only works when I open window with my indicator. It works only also when I jump beetwen charts windows, in other words when I jump between charts time levels. It seems that indicator can not count when whorks. How can I solve my problem ? Need help. Is it conected with Indicatorcounted ? Should I do something in parameter of Alert. How to do it ?
Should I use something like:
double
? = ObjectGetValueByShift(string name, int shift));
if (???????????)
Alert("Pattern on " + Symbol() + " " + Period());
Pucio
Silly Question..
Anyone? Trying to create what must be the simplest indy of all time and screwing up..
Input: Last Tic Value of (1)Pair X and (2) Pair Y.
( both CDF "pairs" ..ie 3 letter symbols))
Output 1: Print onscreen X-Y
Output 2: Plot In Indicator window MA of X-Y..
.Dont ask...LoL
Alert once
Hi,
Please, could you write an example of the code where Alert is only once.
When an object shows up on the chart and you want to have Alert once.
Pucio
Hi,
Please, could you write an example of the code where Alert is only once.
When an object shows up on the chart and you want to have Alert once.
PucioMaybe you could use this piece of code: https://www.mql5.com/en/forum/general
I have an indicator similar to this one. Does anybody know how to pass it's values to EA? I've tried to use buffer, this way
double Trend[];
...
SetIndexBuffer(0,Trend);
...
Trend[0]=UpRating;
return(0);
}
I don't know if it works but I know that all indicator's inscription has gone. Any ideas about it?
need modification help
Hello fellow trader
I need help with this code.
current function is to close first open orders by time and any following orders, mean it could be more than 2 orders closed in the same time.
Question: how do I change it to make it close the FIRST 2 open orders by time ONLY.
here the code.
thanks for help
//+------------------------------------------------------------------+
//| Close Condition Type 2 |
//+------------------------------------------------------------------+
void CheckCloseConditionType2()
{
int Orders[];
int i, j;
ArrayResize(Orders, 0);
int cnt = OrdersTotal();
for (i=0; i < cnt; i++)
{
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != Magic) continue;
int type = OrderType();
if (type == OP_BUY || type == OP_SELL)
{
int size = ArraySize(Orders);
ArrayResize(Orders, size+1);
Orders = OrderTicket();
}
}
//-----
size = ArraySize(Orders);
for (i=0; i < size; i++)
{
if (!OrderSelect(Orders, SELECT_BY_TICKET)) continue;
if (OrderCloseTime() > 0) continue;
datetime tm1 = OrderOpenTime();
for (j=i+1; j < size; j++)
{
if (!OrderSelect(Orders[j], SELECT_BY_TICKET)) continue;
if (OrderCloseTime() > 0) continue;
datetime tm2 = OrderOpenTime();
if (tm1 > tm2)
{
int ticket = Orders;
Orders = Orders[j];
Orders[j] = ticket;
}
}
}
//-----
for (i = size-1; i >= 1; i--)
{
double Profit = ArrayGetOrdersProfit(Orders);
if ((Profit >= TotalTakeProfit && TotalTakeProfit > 0) || (Profit >= Profit2Exit && Profit2Exit > 0))
{
Print("[Enter] Close by condition Type2");
string msg1 = "";
string msg2 = "";
double P;
double T.P = 0;
for (j=0; j < size; j++)
{
if (Orders[j] == -1) continue;
if (!OrderSelect(Orders[j], SELECT_BY_TICKET)) continue;
if (OrderCloseTime() > 0) continue;
if (StringLen(msg1) > 0) msg1 = msg1 + " + ";
msg1 = msg1 + "order " +Orders[j];
GetOrderProfit(Orders[j], P);
if (StringLen(msg2) > 0) msg2 = msg2 + " + ";
msg2 = msg2 +DoubleToStr(P, 2);
T.P += P;
}
Print("Close: " + msg1);
Print("Profit: " + msg2 + " = " + DoubleToStr(T.P, 2));
ArrayCloseOrders(Orders);
Print("[Exit] Close by condition Type2");
return;
}
Orders = -1;
}
}
How to count the numbers of pips
Hi,
I realized that after the market has gone for a great moves (up or down trend). The remaining market is somehow risky to trade with. I am trying to program an EA to avoid entering any trades say after a great move of about 90pips.
I need to know how to calculate the number of pips from first bar at 8am (london market open) to the current bar. If the market has already been moved for more than 90pips I will not take any trade.
Can someone code a few line to give me some clues? Many thanks and appreciated.
Shek
Hi,
I realized that after the market has gone for a great moves (up or down trend). The remaining market is somehow risky to trade with. I am trying to program an EA to avoid entering any trades say after a great move of about 90pips.
I need to know how to calculate the number of pips from first bar at 8am (london market open) to the current bar. If the market has already been moved for more than 90pips I will not take any trade.
Can someone code a few line to give me some clues? Many thanks and appreciated.
ShekIf needed, check first that you are later than 8 am:
Then, find the max and min of the current day. (if its ok for you, its easier than from 8 am): [PHP]double Max = iHigh(Symbol(), PERIOD_D1, 0);
double Min = iLow(Symbol(), PERIOD_D1, 0);
int Range = (Max - Min) / Point;
if(Range > 90) return;
...
I try to add a new feature to this indicator High_Low (Zigzag) V2 so that for every time its formed a new high-low the ZZ will alert me. Don't know where it go wrong. The indi instead doesn't show up on my screen. Anyone?? Help me please.. I'm new to coding, please refine what I have done so that the indi will do just like what I want in the above. Here's the code.
high_low_v2_zigzag_with_alert.mq4
Hi,
How to draw a rectangle background? I mean through conding. I know it uses ObjectCreate() but I don't know how to write it the way I'm suppose to.