As I am new to programming I hope someone can help here, the EA takes the trade initiating both a Long & Short position but it wont place the stops or T.Ps, there are no errors in the code.
*Edit* Never mind... I think I found the answer...
Hope this makes sense
I was wondering if it is possibel to change the colour of an indicator line based on certain conditions, such as a simple MA cross. Red for cross down, Green for cross up?
I have an "MA with colour" indicator that appears to calculate 3 lines (1 each for up, down and sideways) but only draws 1 at a time (if that makes sense) so it appears as if the line changes colour, but in reality, it is plotting 3 different lines over the top of each other...
Is there another way to change colour??
One other thought is to draw it as a histogram in lower windowfor each chart bar, green for cross up, blue for cross down... again, do I have to calcutale 2 sets of data, but only draw 1?? or do I change the colour of the Histogram based on conditions??
I am keen to have a crack at coding it myself, just looking for some guidance on method...
Hi people! Please help me to do next: script will test every result from tester's "optimization results" and save every test in default strategytester report (htm)...
Does anybody know if there is an indicator or ea that combines/checks signals from several indicators (maybe attached to a chart) and produces an alert when specific rules have been met on these indicators. Something like a master indi or ea? Can someone help to code it?
I currently have a set of indicators which are giving some nice signals , they are on the 4 hour chart , is there anyone here that can help me program them so that they send alert when certain trade conditions are met .
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Code Help
As I am new to programming I hope someone can help here, the EA takes the trade initiating both a Long & Short position but it wont place the stops or T.Ps, there are no errors in the code.
Any suggestions or guideness would be great
Code Help
Guys, I am stumped with the modification here, what I am trying to achieve is the following after the trade has commenced
BUY - Once I take a trade and my initial Stoploss and T.P are set,
Then after a preset time after the trade has commenced ie 5min I want to change the position of my Stoploss and TP figures
I want to change my T.P to
OP_SELL + (stoploss * 0.0001) + OP_BUY - OP_ SELL;
then change my stoploss to
OP_BUY - ( stoploss * 0.0001);
Any help appreciated
int orders_total = OrdersTotal();
int orders_number = 0;
for(int i=0; i<orders_total; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if(OrderType()==OP_BUY && OrderSymbol()==Symbol()){
?
Bar timer. entry exit
I am using this code for starting and stopping trading time on a daily basis
extern string StartTime ="07:30";
extern string StopTime ="21:00";
I am looking for a way to use the similar code to but for an hourly bar for e.g.
start 5mins after the bar open
And close 2min before bar close.
bool IsEntryTime() {
datetime tm0 = TimeCurrent();
datetime tm1 = StrToTime(TimeToStr(tm0, TIME_DATE) + " " + StartTime);
datetime tm2 = StrToTime(TimeToStr(tm0, TIME_DATE) + " " + StopTime);
bool isTm = false;
if (tm1 <= tm2)
isTm = isTm || (tm1 <= tm0 && tm0 < tm2);
else
isTm = isTm || (tm1 <= tm0 || tm0 < tm2);
return (isTm);
}
Simple Indicator question
Hi All,
*Edit* Never mind... I think I found the answer...
Hope this makes sense
I was wondering if it is possibel to change the colour of an indicator line based on certain conditions, such as a simple MA cross. Red for cross down, Green for cross up?
I have an "MA with colour" indicator that appears to calculate 3 lines (1 each for up, down and sideways) but only draws 1 at a time (if that makes sense) so it appears as if the line changes colour, but in reality, it is plotting 3 different lines over the top of each other...
Is there another way to change colour??
One other thought is to draw it as a histogram in lower windowfor each chart bar, green for cross up, blue for cross down... again, do I have to calcutale 2 sets of data, but only draw 1?? or do I change the colour of the Histogram based on conditions??
I am keen to have a crack at coding it myself, just looking for some guidance on method...
Cheers
How to code this condition? (1 trade for every signal per day)
Hi everyone, i have a question about coding, my skills are now not so good..
I want to insert this condition for an ea of breakout:
maximum 1 trade for every signal of breakout per day:
How to code it? can you help me?
I'll write an example:
depending to the previous day (High, Low, Close) i have 2 levels of breakout:
3 cases are possible:
1) 0 trade
2) 1 trade (buy or sell depends of breakout)
3) 2 trade (1 buy and 1 sell)
Regards
Luca
Script for MT4 Tester
Hi people! Please help me to do next: script will test every result from tester's "optimization results" and save every test in default strategytester report (htm)...
Thanks
help with running ea
hi all,
i have this ea code that gives me 0 errors and warnings but no trades are ever open. even that backtesting it shows results.
i don't know why, maybe it needs some indicators?
i have notices it uses
iADX = indicator?
iOsMA = function that needs indicator?
iWPR = ?
iMACD = indicator?
if someone can take a look and help me run it i would be most grateful and share my results and settings.
here we go:
#property copyright ""
#property link ""
extern double Lots = 0.0;
extern double Risk = 0.0;
extern double TakeProfit = 0.0;
extern double Stoploss = 0.0;
extern double TrendPower = 0.0;
extern double TrendLevel = 0.0;
extern double Sensitivity = 0.0;
extern double Slippage = 0.0;
extern double MagicNumber = 12225.0;
double g_point_148;
int init() {
g_point_148 = MarketInfo(Symbol(), MODE_POINT);
return (0);
}
int deinit() {
return (0);
}
int start() {
double l_imomentum_16;
double l_iadx_24;
double l_iosma_40;
double l_iwpr_48;
double l_imacd_56;
{
}
double l_lots_0 = 0;
int l_pos_8 = 0;
if (Bars < 10) {
Print("No Trade !!");
return (0);
}
if (OrdersTotal() < 1) {
if (AccountFreeMargin() < 0.1 * Lots) {
Print("Money is Not Enough !!");
return (0);
}
l_lots_0 = MathCeil(AccountEquity() * Risk / 100000.0)/ 10.0 ;
HideTestIndicators(TRUE);
l_imomentum_16 = iMomentum(NULL, 0, TrendLevel, PRICE_OPEN, 0);
l_iadx_24 = iADX(NULL, 0, TrendPower, PRICE_CLOSE, MODE_MAIN, 0);
l_iosma_40 = iOsMA(NULL, 0, 90, 99, 88, PRICE_OPEN, 1);
l_iwpr_48 = iWPR(NULL, 0, Sensitivity, 0);
l_imacd_56 = iMACD(NULL, 0, 90, 99, 88, PRICE_TYPICAL, MODE_SIGNAL, 0);
HideTestIndicators(FALSE);
if (l_imacd_56 > 0.0 && l_iosma_40 > 0.0 && l_imomentum_16 > 100.0 && l_iadx_24 > 21.0 && l_iwpr_48 < -80.0) {
OrderSend(Symbol(), OP_BUY, l_lots_0, Bid, Slippage, Bid - Stoploss * g_point_148, Ask + TakeProfit * g_point_148, "Buy(#" + MagicNumber + ")", MagicNumber, 0, Blue);
return (0);
}
if (l_imacd_56 < 0.0 && l_iosma_40 < 0.0 && l_imomentum_16 < 100.0 && l_iadx_24 -20.0) {
OrderSend(Symbol(), OP_SELL, l_lots_0, Ask, Slippage, Ask + Stoploss * g_point_148, Bid - TakeProfit * g_point_148, "Sell(#" + MagicNumber + ")", MagicNumber, 0, Red);
return (0);
}
}
int l_ord_total_12 = OrdersTotal();
for (l_pos_8 = 0; l_pos_8 < OrdersTotal(); l_pos_8++) {
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
if (OrderType() == OP_BUY) {
if (OrderOpenTime() - (TimeCurrent() >= 300) || AccountProfit() > 2.0) {
if (TimeCurrent() - (OrderOpenTime() >= 300) || AccountProfit() > 2.0) {
OrderClose(OrderTicket(), OrderLots(), Ask, 0, Violet);
return (0);
}
}
}
}
}
l_ord_total_12 = OrdersTotal();
for (l_pos_8 = 0; l_pos_8 < OrdersTotal(); l_pos_8++) {
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderType() <= OP_BUY && OrderSymbol() == Symbol()) {
if (OrderType() == OP_SELL) {
if (TimeCurrent() - (OrderOpenTime() >= 300) || AccountProfit() > 2.0) {
OrderClose(OrderTicket(), OrderLots(), Bid, 0, Violet);
return (0);
}
}
}
}
return (0);
}
Does anybody know if there is an indicator or ea that combines/checks signals from several indicators (maybe attached to a chart) and produces an alert when specific rules have been met on these indicators. Something like a master indi or ea? Can someone help to code it?
coding help Please
Hi
I currently have a set of indicators which are giving some nice signals , they are on the 4 hour chart , is there anyone here that can help me program them so that they send alert when certain trade conditions are met .
Please PM me .
Many Thanks
Tell me the strategy and supply the indicators and I will create an EA for you.
Dave
<<<