+ Reply to Thread
Page 8 of 8 FirstFirst ... 6 7 8
Results 71 to 76 of 76

Thread: Frequently Asked Questions About Coding MQL

  1. #6
    Senior Member sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach's Avatar
    Join Date
    May 2019
    Location
    arifwala,pakistan
    Posts
    2,437
    Thanks
    2,605
    Thanked 4,092 Times in 1,731 Posts
    SubscribeSubscribe
    subscribed 0
    Currency pair USDJPY yesterday reached the light HFT selling pressure zone that was noted at 106.84 and above. All bullish attempts were accurately stopped here

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  2. The Following 6 Users Say Thank You to sumerach For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), CJ7 (2020-10-20), Kanwal (2020-10-19), LOC (2020-10-20), raheel00 (2020-10-19)

  3. #5
    Senior Member sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach has a reputation beyond repute sumerach's Avatar
    Join Date
    May 2019
    Location
    arifwala,pakistan
    Posts
    2,437
    Thanks
    2,605
    Thanked 4,092 Times in 1,731 Posts
    SubscribeSubscribe
    subscribed 0
    Currency pair USDJPY yesterday reached the light HFT selling pressure zone that was noted at 106.84 and above. All bullish attempts were accurately stopped here

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  4. The Following 5 Users Say Thank You to sumerach For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), Kanwal (2020-10-19), LOC (2020-10-20), raheel00 (2020-10-19)

  5. #4
    Member yaseenhfd is a splendid one to behold yaseenhfd is a splendid one to behold yaseenhfd is a splendid one to behold yaseenhfd is a splendid one to behold yaseenhfd is a splendid one to behold yaseenhfd is a splendid one to behold yaseenhfd's Avatar
    Join Date
    Dec 2018
    Posts
    310
    Thanks
    55
    Thanked 663 Times in 212 Posts
    SubscribeSubscribe
    subscribed 0
    Currency pair USDJPY yesterday reached the light HFT selling pressure zone that was noted at 106.84 and above. All bullish attempts were accurately stopped here and USDJPY also closed within this area.

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  6. The Following 5 Users Say Thank You to yaseenhfd For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), Kanwal (2020-10-19), LOC (2020-10-20), raheel00 (2020-10-19)

  7. #3
    Junior Member umarroy is on a distinguished road umarroy's Avatar
    Join Date
    Feb 2018
    Posts
    83
    Thanks
    0
    Thanked 34 Times in 23 Posts
    SubscribeSubscribe
    subscribed 0
    Currency pair USDJPY yesterday reached the light HFT selling pressure zone that was noted at 106.84 and above. All bullish attempts were accurately stopped here and USDJPY also closed within this area.

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  8. The Following 5 Users Say Thank You to umarroy For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), Kanwal (2020-10-19), LOC (2020-10-20), raheel00 (2020-10-19)

  9. #2
    Member duki will become famous soon enough duki will become famous soon enough duki's Avatar
    Join Date
    Sep 2017
    Posts
    631
    Thanks
    78
    Thanked 174 Times in 134 Posts
    SubscribeSubscribe
    subscribed 0

    Need help modification

    There is EA MQL5, simple EA Buy pending order

    How to add Money Management Fixed Risk in its EA,
    meaning the modification of EA to auto lot size depending on the balance of his account,

    Please the master coding ask for his advice.

    PHP Code:
    #include <Trade\Trade.mqh> 

    // exported variables 
    input double Lots5 1
    input int Stoploss5 5
    input int Takeprofit5 100
    input int PriceOffset5 0


    // local variables 
    double PipValue=1;    // this variable is here to support 5-digit brokers 
    bool Terminated false
    string LF "\n";  // use this in custom or utility blocks where you need line feeds 
    int NDigits 4;   // used mostly for NormalizeDouble in Flex type blocks 
    int ObjCount 0;  // count of all objects created on the chart, allows creation of objects with unique names 
    int current 0



    //+------------------------------------------------------------------+ 
    //| Expert initialization function                                   | 
    //+------------------------------------------------------------------+ 
    int OnInit() 

        
    //--- 
        
    NDigits Digits(); 
        if (
    NDigits == || NDigits == 5PipValue 10
         
        if (
    AccountInfoInteger(ACCOUNT_TRADE_EXPERT) == false
        { 
            Print(
    "Check terminal options because EA trade option is set to not allowed."); 
            
    Comment("Check terminal options because EA trade option is set to not allowed."); 
        } 
         
        if (
    falseObjectsDeleteAll(0);      // clear the chart 
         
         
        
    Comment("");    // clear the chart 
        //--- 
        
    return(0); 

    //+------------------------------------------------------------------+ 
    //| Expert deinitialization function                                 | 
    //+------------------------------------------------------------------+ 
    void OnDeinit(const int reason

        
    //--- 
        
    if (falseObjectsDeleteAll(0); 
         
         

    //+------------------------------------------------------------------+ 
    //| Expert tick function                                             | 
    //+------------------------------------------------------------------+ 
    void OnTick() 

        
    //--- 
        
    if (Terminated == true
        { 
            
    Comment("EA Terminated."); 
        } 
         
        
    OnEveryTick1(); 


    //+------------------------------------------------------------------+ 
    //| Get Low for specified bar index                                  | 
    //+------------------------------------------------------------------+ 
    double Low(int index

        
    double arr[]; 
        
    double low 0
        
    ArraySetAsSeries(arrtrue); 
        
    int copied CopyLow(Symbol(), PERIOD_CURRENT0Bars(Symbol(), PERIOD_CURRENT), arr); 
        if (
    copied>&& index<copiedlow arr[index]; 
        return (
    low); 

    //+------------------------------------------------------------------+ 
    //| Get the High for specified bar index                             | 
    //+------------------------------------------------------------------+ 
    double High(int index

        
    double arr[]; 
        
    double high 0
        
    ArraySetAsSeries(arrtrue); 
        
    int copied CopyHigh(Symbol(), PERIOD_CURRENT0Bars(Symbol(), PERIOD_CURRENT), arr); 
        if (
    copied>&& index<copiedhigh=arr[index]; 
        return(
    high); 

    //+------------------------------------------------------------------+ 
    //| Get Close for specified bar index                                | 
    //+------------------------------------------------------------------+ 
    double Close(int index

        
    double arr[]; 
        
    double close 0
        
    ArraySetAsSeries(arrtrue); 
        
    int copied CopyClose(Symbol(), PERIOD_CURRENT0Bars(Symbol(), PERIOD_CURRENT), arr); 
        if (
    copied>&& index<copiedclose arr[index]; 
        return (
    close); 

    //+------------------------------------------------------------------+ 
    //| Get Open for specified bar index                                 | 
    //+------------------------------------------------------------------+ 
    double Open(int index

        
    double arr[]; 
        
    double open 0
        
    ArraySetAsSeries(arrtrue); 
        
    int copied CopyOpen(Symbol(), PERIOD_CURRENT0Bars(Symbol(), PERIOD_CURRENT), arr); 
        if (
    copied>&& index<copiedopen arr[index]; 
        return (
    open); 

    //+------------------------------------------------------------------+ 
    //| Get current bid value                                            | 
    //+------------------------------------------------------------------+ 
    double Bid() 

        return (
    SymbolInfoDouble(Symbol(), SYMBOL_BID)); 


    //+------------------------------------------------------------------+ 
    //| Get current ask value                                            | 
    //+------------------------------------------------------------------+ 
    double Ask() 

        return (
    SymbolInfoDouble(Symbol(), SYMBOL_ASK)); 


    //+------------------------------------------------------------------+ 
    //| Is there an error                                                | 
    //+------------------------------------------------------------------+ 
    bool IsError(MqlTradeResultresultstring function) 

        if (
    result.retcode != && result.retcode != TRADE_RETCODE_DONE && result.retcode != TRADE_RETCODE_PLACED
        { 
            Print(
    "Function: ", function, " Error: "result.retcode" "result.comment); 
            return (
    true); 
        } 
        else 
        Print(
    "> Executed: [", function, "]"); 
        return (
    false); 


    bool IsError(CTradetradestring function) 

        if (
    trade.ResultRetcode() != && trade.ResultRetcode() != TRADE_RETCODE_DONE && trade.ResultRetcode() != TRADE_RETCODE_PLACED
        { 
            Print(
    "Function: ", function, " Error: "trade.ResultRetcode(), " "trade.ResultRetcodeDescription()); 
            return (
    true); 
        } 
        else 
        Print(
    "> Executed: [", function, "]"); 
        return (
    false); 


    //+------------------------------------------------------------------+ 
    //| Get indicator value back                                         | 
    //+------------------------------------------------------------------+ 
    double GetIndicator(int handleint buffer_numint index

        
    //--- array for the indicator values 
        
    double arr[];     
        
    //--- obtain the indicator value in the last two bars 
        
    if (CopyBuffer(handlebuffer_num0index+1arr) <= 0
        {         
            
    Sleep(200); 
            for(
    int i=0i<100i++) 
            { 
                if (
    BarsCalculated(handle) > 0
                break; 
                
    Sleep(50); 
            } 
            
    int copied CopyBuffer(handlebuffer_num0index+1arr); 
            if (
    copied <= 0
            { 
                Print(
    "CopyBuffer failed. Maybe history has not download yet? Error = "GetLastError()); 
                return -
    1
            } 
            else 
            return (
    arr[index]); 
        } 
        else 
        { 
            return (
    arr[index]); 
        } 
         
        return 
    0


    //+------------------------------------------------------------------+ 
    //| Building blocks                                                  | 
    //+------------------------------------------------------------------+ 
    void OnEveryTick1() 

         
        if (
    NDigits == || NDigits == 5PipValue 10
         
        
    OncePerBar2(); 
         


    void OncePerBar2() 

        static 
    datetime Old_Time
        
    datetime New_Time[1]; 
        
    // copying the last bar time to the element New_Time[0] 
        
    int copied CopyTime(Symbol(), Period(), 01New_Time); 
        if (
    copied 0)     // ok, the data has been copied successfully 
        

            if (
    Old_Time != New_Time[0]) // if old time isn't equal to new bar time 
            

                
    Old_Time=New_Time[0];            // saving bar time 
                
    BuyPendingOrder25(); 
                 
            } 
            else 
            { 
                return;     
    // still the same bar 
            

        } 
        else 
        { 
            
    Alert("Error in copying historical times data, error =",GetLastError()); 
            
    ResetLastError(); 
            return; 
        } 


    void BuyPendingOrder25() 

         
        
    double price NormalizeDouble(High(2), NDigits) - PriceOffset5*PipValue*Point(); 
        
    double SL price Stoploss5*PipValue*Point(); 
        if (
    Stoploss5 == 0SL 0
        
    double TP price Takeprofit5*PipValue*Point(); 
        if (
    Takeprofit5 == 0TP 0
         
        
    //--- prepare a request 
        
    MqlTradeRequest request
        
    ZeroMemory(request); 
        
    request.action=TRADE_ACTION_PENDING;         // setting a pending order 
        
    request.magic 1;                  // ORDER_MAGIC 
        
    request.symbol Symbol();                      // symbol 
        
    request.volume Lots5;                          // volume in 0.1 lots 
        
    request.sl SL;                                // Stop Loss is not specified 
        
    request.tp TP;                                // Take Profit is not specified 
        
    request.deviation 3;                         // deviation in 5 points 
        
    request.price price
        
    request.type_time ORDER_TIME_SPECIFIED
        
    request.expiration TimeTradeServer()+PeriodSeconds(PERIOD_D1)-2
        
    //--- form the order type 
        
    request.type ORDER_TYPE_BUY_STOP;           // order type ORDER_TYPE_BUY_LIMIT, ORDER_TYPE_SELL_LIMIT, ORDER_TYPE_BUY_STOP, ORDER_TYPE_SELL_STOP 
        //--- form the price for the pending order 
        
    MqlTradeResult result
        
    ZeroMemory(result); 
        
    OrderSend(request,result); 
        
    // check the result 
        
    if (!IsError(result__FUNCTION__)) 
        { 
             
        } 
         
         
         
         
         
         
         
         
         
         
         
         
         
         

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  10. The Following 5 Users Say Thank You to duki For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), Kanwal (2020-10-19), LOC (2020-10-20), raheel00 (2020-10-19)

  11. #1
    Member wosh has a spectacular aura about wosh has a spectacular aura about wosh's Avatar
    Join Date
    Sep 2017
    Posts
    543
    Thanks
    48
    Thanked 178 Times in 132 Posts
    SubscribeSubscribe
    subscribed 0

    Frequently Asked Questions About Coding MQL

    me as newbie in the field of MQL coding please permission to open this thread ...
    If the moderator is not welcome or there is already a similar thread, please invite me to delete it ...

    Frankly, I am confused to look for the problems that come out in every code I make ...

    This is what it is ,, and it should search in different threads for every problem that arises ...

    So, I want to be grouped into one, so easy to find ...

    To the point, I created this thread to unify the problems encountered by the beginner coder (like me) in terms of MQL coding, especially MQL4. Suppose my EA codes have problems with their Order Modify, and there are master coding passes or the residents of MT5 who know the problem solving + answer it better. So do not have to look at the thread one by one from the thread in question with the problem coded, where the TS of the thread is also not every time online continue.

    So, with one thread it's better to discuss coding with a passing coding master or MT5 resident who understands the problem of coding ...

    The goal is to better help the beginner coder, like me, in understanding every coding used.
    So even though the coding copy, we still understand the coding used. Gratitude from there we can make EA that really profitable as desired.

    For master coding + residents of MT5 who know the problem solving, please voluntarily share, so that Indonesian coder can be more advanced again and increasing quality ...

    Note: Let the newbie coder know very well about the codingan, please share the codingannya and discussion than in the form already so EA ...
    Add confused

    Though trading on financial markets involves high risk, it can still generate extra income in case you apply the right approach. By choosing a reliable broker such as InstaForex you get access to the international financial markets and open your way towards financial independence. You can sign up here.


  12. The Following 6 Users Say Thank You to wosh For This Useful Post:

    Alizahid (2020-10-20), Boss12 (2020-10-19), lionel (2018-02-28), raheel00 (2020-10-19), sinjo abe (2018-02-28), tatang (2018-02-28)

+ Reply to Thread
Page 8 of 8 FirstFirst ... 6 7 8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Currently Active UsersCurrently Active Users

There are currently users online. members and guests

Forex Forum India | Forex Community Place Statistics Forex Forum India Statistics

Most users ever online was .

Welcome to our newest member,

Threads:

Posts:

Member: