PLEASE help me to modify this script available in new version MT4 client of FXCM!!!!!

 

It does not work in new version mt4 client of FXCM though It was working perfectly before.

http://download.fxcorporate.com/FXCM-MT4Install.exe

//+------------------------------------------------------------------+
//|                                           OneKeyBuyMorePairs.mq4 |
//|                                                         Lei Yang |
//|                                              yangleitj@gmail.com |
//|                                      |
//+------------------------------------------------------------------+
#property copyright "Lei Yang"
#property link      ""

//+--------------------------------------------------------------------------------------+
//| Many thanks for anen's support and help.  http://my.fx678.com/space-uid-21861.html   |
//+--------------------------------------------------------------------------------------+
int start()
  {

   double alt_bid ;
   double alt_ask ;

//----
   int ticket11=OrderSend("AUDUSD",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket12=OrderSend("AUDJPY",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket13=OrderSend("AUDCHF",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket21=OrderSend("USDCAD",OP_SELL,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket22=OrderSend("CADJPY",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket23=OrderSend("CADCHF",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket31=OrderSend("EURUSD",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket32=OrderSend("EURJPY",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket33=OrderSend("EURCHF",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket41=OrderSend("GBPUSD",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket42=OrderSend("GBPJPY",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket43=OrderSend("GBPCHF",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket51=OrderSend("NZDUSD",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket52=OrderSend("NZDJPY",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
   int ticket53=OrderSend("NZDCHF",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE); //Specific Currency pair must match broker's Symbol
//----
    return(0);
  }
//+------------------------------------------------------------------+
Files:
 
What errors do you get ?
 
i don't c a price what is this
double alt_bid ;
double alt_ask ;
the problem is definitely not in the platform u using
 
yangleitj:

It does not work in new version mt4 client of FXCM though It was working perfectly before.

http://download.fxcorporate.com/FXCM-MT4Install.exe

Excuse my disbelief of your statement that "it was working perfectly before". You have the same uninitialized variable alt_ask for every single order, which include buys and sells. That has NEVER worked. Obviously the Bid and Ask prices have to be changed according to each currency. If something like the code above used to work then somebody has deleted the important parts where the Bid and Ask prices were set.

The only answer I have if this EXACT code did ever work with another broker is that the uninitialized variable is set to zero by the compiler (not guaranteed) and the broker accepts 0 as buy or sell at market (not a valid method).

 
dabbler:
uninitialized variable is set to zero by the compiler (not guaranteed)
Initialization of variables - MQL4 Documentation
Any variable is initialized with zero (0) if no other initial value is explicitly defined.
 
Thank you, I missed that MQL4 specific variation. In standard C local variables are not initialized, although I think with MS compilers in debug mode they get set to some bizarre value so that you spot the error. Personally I use the C++ style and don't leave uninitialized variables in the code, declaring them and defining them at the same time.
 
Thank you all very much! Could you give me a complete and correct script that could work in MT4 of FXCM, PLEASE!
 
yangleitj:
Thank you all very much! Could you give me a complete and correct script that could work in MT4 of FXCM, PLEASE!


This never worked on FXCM before or now.

Try this on each one of your OrderSend() function so you know what error you are getting!

#include <stdlib.mqh>
#include <WinUser32.mqh>
  

   int ticket11=OrderSend("EURUSD",OP_BUY,0.01,alt_ask,3,0,0,"OneKeyBuyMorePairs",255,0,CLR_NONE);
   if(ticket11<1)
   {
      int error=GetLastError();
      Print("Error = ",ErrorDescription(error));
      return;
   }

Maybe you will get an error like this.

2012.02.01 22:43:35     OneKeyBuyMorePairs EURUSD,M5: Error = invalid price

Then you can look at a sample script that comes with the product. Maybe the one called trade.mq4 and look at the OrderSend( ) in that file then look back at yours and find the difference?

Hint!!! it's between Lots and Slippage. That would be the 0.01 and 3.

Then you will get this many times.

2012.02.01 22:44:25     OneKeyBuyMorePairs EURUSD,M5: open #600114 buy 0.01 EURUSD at 1.31842 ok

That looks like it took 50 seconds to get that to work.

Reason: