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
Hello,
I have problem with this Script:
//+------------------------------------------------------------------+
//| CloseHalf.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#include <stdlib.mqh>
#include <WinUser32.mqh>
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start(){
//double MAXLOT = GlobalVariableGet("MAXLOT");
//while(MathMod(MAXLOT * 100, 2.0) > 0) {
// MAXLOT -= .01;
//}
OrderSelect(0,SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type) {
case OP_BUY:
result = OrderClose(OrderTicket(), GlobalVariableGet("HALFLOT"),MarketInfo(Symbol(),MODE_BID),5);
break;
case OP_SELL:
result = OrderClose(OrderTicket(), GlobalVariableGet("HALFLOT"), MarketInfo(Symbol(),MODE_ASK),5);
}
if(result == false) {
Alert("Order ",OrderTicket()," failed to close. Error:",GetLastError());
Sleep(3000);
}
return(0);
}
//+------------------------------------------------------------------+
It works in all currencies which I trade (EUR/USD; AUS/USD; GBP/USD; USD/CHF; EUR/ GBD; EUR/JPY ; EUR/CHF; GDP/JPY)
but not in USD/CAD.
Who may give me some help?
Sometimes I get also the Error 129
York