There's not much wrong with your OrderClose syntax. When the broker's trade server rejects the order in fast markets you'll get a 138 error ie a requote. You need to write code to handle a requote error and re-submit the Orderclose requests.
You can create a wide array of error handling code for both execution and exit. I use a an external library file which contains generic order execution and exit functions to cater for these issues.
With this tool you can run any EA for standard FXCM Trade Station. All your trades in MT4 will be transferred instantly to FXCM account. Support Market open, Market close, create pending orders and delete pending orders.
Installation:
1. Download the package.
2. Through installation choose METATRADER FOLDER as destination.
3. Run MT4 and attach LetsFX-MT2CM expert to any chart.
4. Fill your FXCM login at Input of EA dialog.
Limitations:
1. Send orders to only one FXCM account.
2. Does not modify pending orders, stoploss or takeprofit.
Requirements:
You have to install FXCM runtime library on your computer from this link: FXCM Order2go runtime
Hello to all
i don't know if you heared about Vladimir rebakuv but this guy already created 3 Expert Advisors:
1.Broker nightmare.
2.forex nightfox
3.srs trend rider.
All of them were greate success and now he is coming with a new one:
Black Panther, i found a review about this product:
Please I have an EA that I am working on, however, the start() function is being executed at every tick. I want the start() function to be executed at the close of each bar (say if attached to a one hour chart) and not at every tick.
My code snippet to control bar opening time is pasted below but it is not working as expected as new ticks still get processed within bars.
Want to recommend you the new EA made by a woman and her team - this is Rita Lasker's FishForexRobot. Now it is sold on a lower price than it really costs, because it is pretty new at the market, though worthful. So, do not loose time! By the way, firstly you may visit her free robot site - robot4free.
You need to do this:
When opening trades - do not include the stops
After the order is opened, modify it adding the stops
Some ECNs do not accept partial closing
Please I have an EA that I am working on, however, the start() function is being executed at every tick. I want the start() function to be executed at the close of each bar (say if attached to a one hour chart) and not at every tick.
My code snippet to control bar opening time is pasted below but it is not working as expected as new ticks still get processed within bars.
Are you or anybody i this forum able to help me with a snippet to control bar opening time?
ta
supa
This is what I use
bool Continue_Processing(int CheckFrequency, int CheckInterval, datetime TimeStamp, int ThisMinute, int TheBarShift)
// not all code in in function is shown
if(CurrentTimeStamp != TimeStamp) //Process once per bar on bar open
{
TheBarShift = 1;
CurrentTimeStamp = TimeStamp;
return(true);
}
else return(false);
also rather than make pTime static, just make it global as that is what it is, just don't use it in any of your other functions.
Now, I have a problem. I want to place pending orders just above/below the Current BID and I assume I have to add the "stoplevel" to the BID to get a valid pending order. When I execute the following code on FXCM I get a return value of zero for stoplevel.
I have executed the same code on FXDD and it works fine.
Is it an implementation Bug with FXCM and if so, are there any workarounds to get a good estimate of the stoplevel. I have considered a recursive function that adds a pip to the BID until the pending order is placed.
I also have a second question. I have a high speed quad processor and am testing my EA on several demo accounts simultaneously. The foreground EA seems to work correctly but I have instances where the background EAs are "going to sleep" e.g. not processing on every new bar. Is this due to a lack of cpu cycles for the background processes or is it a MT4 limitation.
Please I have an EA that I am working on, however, the start() function is being executed at every tick. I want the start() function to be executed at the close of each bar (say if attached to a one hour chart) and not at every tick.
My code snippet to control bar opening time is pasted below but it is not working as expected as new ticks still get processed within bars.
Are you or anybody i this forum able to help me with a snippet to control bar opening time?
ta
supa
Hi, noticed there didn't seem to be an answer to your question. The start function will always be run when an incoming tick is received on the MT4 chart your EA or indicator is loaded on.
If you wanted to optimise your EA/Indy to only run when a new bar was created on the chart you would just write a new bar sensing function so that when the number of bars on the chart changed you would allow your routines to execute. You can easily write a little function using the 'Bars' integer function which tells you the number of bars on the current chart. Just call your created function from start() and don't put any code in start() which doesn't need to be executed on each tick. Let me know if you need an example.
Cheers
FXAlgoTrader - Algorithmic Systems and Tool Developer
What's the EA? What does it do? Who wrote it? It should be able to handle fractional pricing if it's been written properly
FXAlgoTrader - Algorithmic Systems and Tool Developer
The EA is very simple based on the AO-Filter. The Terms to open and close are very simple. Because when the signal for a buy ist there, the ea will close the open sell and open a buy. If the signal for a sell is given, than the open buy will be closed and the sell will be opened.
In addition are the opportunities run the moneymanagement and the SL/TP manually.
It was written by a guy who programs ea's for the mt4.
Fractional pricing - no, idea ... therefore I am to blond.
I just wonder that this ea is running with Alpari (5 digit) without any problems.And the real funny thing is, in the backtest he shows every single signal - but unfortunately he is not doing this in real.
But in anyway ... here is the code for the ea. May you can see an error.
Sarah
extern int Puffer=3;
extern int Abstand=1;
extern int Magic=100526;
extern bool TpSlBeachten=false;
extern int TP=100;
extern int SL=100;
extern string Lotstring="Lotberechnung=false wird die Lotsgröße unten genommen";
extern string Lotstring2="Lotberechnung=true wird es von Acc abhängig sein";
extern bool Lotberechnung=false;
extern double Lotgroesse=0.1;
extern string Lotstring3="Parameter für Lotberechnung";
extern int Faktor=5000;
double Lots;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if (Close[0]>High[1]+(Abstand*Point*10) && indi1==0)
longonly=true;
if (Close[0]
shortonly=true;
//Comments
Comment( "\n eRosiTeil2",
"\n\n T R A D E S E S S I O N",
"\n*=====================*",
"\n Broker Time = ", Hour()+" : "+Minute(),
"\n*=====================*",
"\n L O T S = " + Lots,
"\n B A L A N C E = " + DoubleToStr(AccountBalance(),2),
"\n S P R E A D = " + (Ask-Bid)/Point*10,
"\n*=====================*",
"\n L O N G = " + long,
"\n S H O R T = " + short,
"\n Ticket = "+ticket,
"\n TpSlBeachten = "+TpSlBeachten,
"\n TP = "+TP,
"\n SL = "+SL,
"\n*=====================*");
WindowRedraw();
//EXIT
if (long)
{
OrderSelect(ticket,SELECT_BY_TICKET);
if (Close[0]>OrderOpenPrice()+(TP*Point*10) && TpSlBeachten)
{
fSi---it (ticket,long, short,Puffer,"TP");
}
if (Close[0]
{
fSi---it (ticket,long, short,Puffer,"SL");
}
if (shortonly)
{
fSi---it (ticket,long, short,Puffer,"LongAufShort");
}
}
if (short)
{
OrderSelect(ticket,SELECT_BY_TICKET);
if (Close[0]
{
fSi---it (ticket,long, short,Puffer,"TP");
}
if (Close[0]>OrderOpenPrice()+(SL*Point*10) && TpSlBeachten)
{
fSi---it (ticket,long, short,Puffer,"SL");
}
if (longonly)
{
fSi---it (ticket,long, short,Puffer,"ShortAufLong");
}
}
//Position öffnen
if (!long && !short && firsttrade)
{
if (longonly)
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"eRosiDiffLong",Magic,0,Green);
if(OrderSelect(ticket,SELECT_BY_TICKET))
{
Print("Buy order opened : ",OrderOpenPrice());
long=true;
firsttrade=false;
}
else Print("Error opening Buy order : ",GetLastError());
}
if (shortonly)
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"eRosiDiffShort",Magic,0,Red);
if(OrderSelect(ticket,SELECT_BY_TICKET))
{
Print("Sell order opened : ",OrderOpenPrice());
short=true;
firsttrade=false;
}
else Print("Error opening Sell order : ",GetLastError());
}
}
Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.