OrderSend fucn. help

 
hello
my order send func does not work
plz help me
sorry my english in not good
tnx
extern

int TimeFrame = 60; extern int MA_Price = 5; extern int MA_Length = 21; extern int MA_Mode = 1; extern int Atrlength = 14; extern double Kv = 4.0 ; extern double MoneyRisk = 1.0; extern bool ab = false; extern bool abc = false; extern int abcd = 0; extern bool abcde = false; extern bool abcdef = false; extern bool abcdeg = false; extern bool abcdeh = false; extern bool abcdei = false; extern string ahang = "alert2.wav"; extern double hajm = 1; extern int ST = 30; extern int TP = 100;    double val1 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,0,0);    double val2 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,1,0);    double val3 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,2,0);    double val4 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,3,0); void OnTick(){          if(val1 != 0 && val3!= 0 && val2 == 0 && val4 == 0){                   OrderSend(Symbol(),OP_BUY,hajm,Ask,10,0,0,0,0,0,Green);           }       if(val1 == EMPTY_VALUE && val3 == EMPTY_VALUE && val2 != EMPTY_VALUE && val4 != EMPTY_VALUE){             OrderSend(Symbol(),OP_SELL,hajm,Bid,10,0,0,0,0,0,Red);       }    }


 
mr.hosseinzadeh:


What you mean with does not work?

  1. Error => log error number?
  2. OrderSend never called check your logic with the debugger (Editor F5)?
  3. Something else?
 
Carl Schreiber:

What you mean with does not work?

  1. Error => log error number?
  2. OrderSend never called check your logic with the debugger (Editor F5)?
  3. Something else?

when the bet is correct, the order will not be sent.

there is no error in meta editor and metatarder.

 
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless.

  2. Use Strict. It will help you.
              Program Properties (#property) - Preprocessor - Language Basics - MQL4 Reference

  3.          OrderSend(Symbol(),OP_BUY,hajm,Ask,10,0,0,0,0,0,Green);
    Check your return codes for errors, report them and you would know why.
              What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
              Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
    Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after.

  4.    double val1 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,0,0);
       double val2 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,1,0);
       double val3 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,2,0);
       double val4 = iCustom(Symbol(),TimeFrame,"Volty Channel Stop mtf",TimeFrame,MA_Price,MA_Length,MA_Mode,Atrlength,Kv,MoneyRisk,ab,abc,abcd,abcde,abcdef,abcdeg,abcdeh,abcdei,ahang,3,0);
    void OnTick(){
    These global variables never update. Assign them in OnTick. They don't need to be global either.

    You're not calling OrderSend and the lack of an error message would have told you that had you followed #3.

  5. Once you get it to open an order, it will open a new one every tick.

  6. Next time, please don't add text inside quoted text or CODE blocks, put it outside.
              MQL4 forum editor problem - MQL4 and MetaTrader 4 - MQL4 programming forum

Reason: