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
please,help about trailing
I created an EA by Forex EA Generator, everything seems works, the trailing works on BUY as required, but it doesn't work on SELL,
please help me to understand where is the mistake,
thanks
..................................
IfOrderDoesNotExist8();
}
}
void IfOrderDoesNotExist8()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
BuyOrder24();
}
}
void BuyOrder24()
{
double SL = Ask - BuyStoploss24*PipValue*Point;
if (BuyStoploss24 == 0) SL = 0;
double TP = Ask + BuyTakeprofit24*PipValue*Point;
if (BuyTakeprofit24 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots24, Ask, 3, 0, 0, "36912direct5M@", 1, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots24, Ask, 3, SL, TP, "36912direct5M@", 1, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CloseOrder21()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TrailingStop10()
{
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
double takeprofit = OrderTakeProfit();
if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop10*PipValue*Point)
{
if (OrderStopLoss() < Ask-(TrailingStop10+TrailingGap10)*PipValue*Point)
{
if (NewTakeProfit10 != 0) takeprofit = Ask+(NewTakeProfit10 + TrailingStop10)*PipValue*Point;
bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-TrailingStop10*PipValue*Point, takeprofit, OrderExpiration(), White);
if (ret1 == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop10*PipValue*Point)
{
if (OrderStopLoss() > Bid+(TrailingStop10+TrailingGap10)*PipValue*Point)
{
if (NewTakeProfit10 != 0) takeprofit = Bid-(NewTakeProfit10 + TrailingStop10)*PipValue*Point;
bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+TrailingStop10*PipValue*Point, takeprofit, OrderExpiration(), White);
if (ret2 == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
}
else
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
Variation indicator need help to plot in chart_window
This is indicator:
//+------------------------------------------------------------------+
//| variation.mq4 |
//| Copyright © 2010, LeMan. |
//| b-market@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, LeMan."
#property link "b-market@mail.ru"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int N=20;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
IndicatorDigits(Digits+2);
IndicatorBuffers(2);
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
//----
if (N <= 0) N = 20;
//----
SetIndexDrawBegin(0, N*2);
//----
short_name = "Variation (" + N + ")";
IndicatorShortName(short_name);
SetIndexLabel(0, short_name);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int limit = Bars-N-1;
for (int i = limit; i >= 0; i--) {
double ma = iMA(NULL,0,N,0,MODE_SMA,PRICE_CLOSE,i);
ExtMapBuffer2 = Close-ma;
}
//----
i = Bars-N*2-1;
while (i >= 0) {
double vr = iMAOnArray(ExtMapBuffer2,Bars,N,0,MODE_SMA,i);
double mov = iMA(NULL,0,N,0,MODE_SMA,PRICE_CLOSE,i);
ExtMapBuffer1 = Close - (mov + vr);
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
EA Coder Required
Forex trader with 10 years experience requires EA coder
with trading experience.
The TradeWynds system:
Higher Timeframe Filter
H1 or D1
All entries taken within a 3 pip entry window using a 10 pip SL.
Entries may be taken in both directions.
2 - 3 indicators used.
Exits on H1 or D1.
Please PM if interested . . .
If you have a profitable EA, I'll code it for you or let you know if it's really beyond my ability.
Build script
Coder's Guru
I've tried searching the various forums of the Net an expert or a script to issue pending orders with a specified time in order to operate in "News". Got some but have not been satisfactory. I tried to make an EA that did not work and can not identify the failure. I tried to make a script to add the chart but could not succeed. I tried to modify a script's standard MT4 also without success. I wonder if you can help me build a script for this purpose ... Issue orders pending buy and sell at pre determined time.
thank you,
Paulo.peba
iATR not works on XAGUSD and XAUUSD
Merry Christmas and a Happy New Year!
I want to do an indicator that scans multiple symbols in different time frames. The symbols XAGUSD and XAUUSD shows ATR only 0.000.
What is wrong?
double atr=iATR(symbol,timeframe[j],8,1)
12:28:48 Scan EURUSD,M1: EURJPY 5 ATR = 0.0325
12:28:48 Scan EURUSD,M1: EURJPY 15 ATR = 0.055
12:28:48 Scan EURUSD,M1: EURJPY 30 ATR = 0.0988
12:28:48 Scan EURUSD,M1: EURJPY 60 ATR = 0.1513
12:28:48 Scan EURUSD,M1: EURJPY 240 ATR = 0.2475
12:28:48 Scan EURUSD,M1: EURJPY 1440 ATR = 0.81
12:28:48 Scan EURUSD,M1: XAGUSD 5 ATR = 0
12:28:48 Scan EURUSD,M1: XAGUSD 15 ATR = 0
12:28:48 Scan EURUSD,M1: XAGUSD 30 ATR = 0
12:28:48 Scan EURUSD,M1: XAGUSD 60 ATR = 0.1662
12:28:48 Scan EURUSD,M1: XAGUSD 240 ATR = 0
12:28:48 Scan EURUSD,M1: XAGUSD 1440 ATR = 1.2625
12:28:48 Scan EURUSD,M1: XAUUSD 5 ATR = 0
12:28:48 Scan EURUSD,M1: XAUUSD 15 ATR = 0
12:28:48 Scan EURUSD,M1: XAUUSD 30 ATR = 0
12:28:48 Scan EURUSD,M1: XAUUSD 60 ATR = 0
12:28:48 Scan EURUSD,M1: XAUUSD 240 ATR = 0
12:28:48 Scan EURUSD,M1: XAUUSD 1440 ATR = 38.8625
Regards
derumuro
Help Needed In Coding A Trendline-Pullback/Retest Indicator Plus With Alert
Hi traders, is there anybody here who can help me to code an indicator which is able to mark out a proper trendline/channel, followed by a breakout alert (if there's any) and alert us when there's a pullback on it. The pullback can also be a retracement to the 38.2%, 50% or 61.8% Fib level. I need something which can mark out a proper trendline/channel cause I feel that most of the auto-trendline or auto-channel indicators are not marking out the proper line. I've been searching high and low in most of the forums but could not find any of this so-called trendline pullback indicator. I've tried DeMark but I'm not really comfortable in using it. I'm not sure whether this indicator is possible to code. But I believe that nothing is possible in this world. Cheers...
Hi Blackwood
If you have a profitable EA, I'll code it for you or let you know if it's really beyond my ability.
With reference to post #148, is it possible to code an EA? If it can be done, I believe the EA can be used for scalping... Do try to work it out, yeah.. Thanks in advance..
Need help remodel EA
Hi ....
Anyone willing to help me add the HH and LL in H1 to show trends in EA below and change the red line and blue to Supplay and demand in H1? I found this on the EA forums and I modify it but not perfect. I want this EA works based Supplay and Demand to see the trend by using the HH and LL. I hope EA can be an entry from the M5 with a yellow Supplay Demand and Demand Supplay refers to the red and blue in H1 (red and blue are now false, not Supplay and Demand, Please be modified into Supplay and Demand). Trend and reversal of form we take the form of HH and LL series in H1.
Thank you.
Please tell me how to make an entry after Take Profit:)
Hi,genius coder & kind people:D
Now I'm developing a simple EA but can't understand below conditions.
If previous position is closed by Take Profit,make new entry that set 20 pips by s/l and t/p at next open price.(on 5M chart)
I tried to write one.
if(OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)) //Last position was instant order OP_BUY or OP_SELL
{
if(OrderClosePrice() == OrderTakeProfit()) // IF close price is the same with take profit price
{
if(OrderType() == OP_BUY) //That order's order type is buy
{
OrderSend(OP_BUY,Lots,Ask,Slippage,SLpips,Ask+20*Point,"",MAGIC);// Lots and other variables is defined by my self
}
else if(OrderType() == OP_SELL)
{
OrderSend(OP_SELL,Lots,Bid,Slippage,SLpips,Bid-20*Point,"",MAGIC);
}
}
I tried many time run by Strategy tester,but can't action as I'm hoping.
Some body give me a help from this question!!
Regards.