के नये स्टार्टाप बोनस के साथ कोई
भी जोखिम और जमा के बिना
व्यापार शुरू करें
बोनस 1000$
GET BONUS
55%
from InstaForex
on every deposit
+ Reply to Thread
Page 2 of 5 FirstFirst 1 2 3 4 ... LastLast
Results 11 to 20 of 42

Thread: Usefull MQ4 Code Snippets/Functions

  1. #11
    Banned motiurbd is on a distinguished road motiurbd's Avatar
    Join Date
    May 2011
    Location
    Bangladesh
    Posts
    179
    Accumulated bonus
    74.4 USD
    Thanks
    0
    Thanked 22 Times in 12 Posts
    Quote Originally Posted by peteonthenet View Post
    Here is the code fuction which will return the total number of lots which are currently running in open trades :

    Parameters: key is magic number, and type is the type of trades .


    Code:
    double gettotallot(int _key, int type)
    {
    double _lot=0;
     for(int k=OrdersTotal(); k>=0; k--)
                    {  
                      if (OrderSelect(k,SELECT_BY_POS,MODE_TRADES)&& OrderSymbol()==Symbol()&& OrderMagicNumber()==_key && OrderType()==type)
                      _lot+=OrderLots();
                      } 
                  return(_lot); 
     }
    Awesome dude... I am learning a lot from your post.. Please carry on... And can you please also show us how to build an EA that will close all our opened order at once? Thanks and keep going

  2. LFC
  3. #12
    Banned FxBd is an unknown quantity at this point FxBd's Avatar
    Join Date
    Jan 2012
    Posts
    68
    Accumulated bonus
    31.8 USD
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by peteonthenet View Post
    Following is a custom function which when called will return total of active trades for a particular magic number:


    Code:
    int CountAllTrades(int magic) {
       int c=0;
       for (int j=OrdersTotal()-1;j>=0;j--)
       {
          OrderSelect(j,SELECT_BY_POS,MODE_TRADES);
          if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic) c++;
       }
       
       return(c);
    }
    This code is really very nice.I think it will help the new traders to make a position in the forex market by collecting and making the right use of the same categories codes in future.

  4. #13
    Member xiaotanghao will become famous soon enough xiaotanghao's Avatar
    Join Date
    Feb 2012
    Posts
    316
    Accumulated bonus
    145.85 USD
    Thanks
    0
    Thanked 89 Times in 35 Posts
    Thank you for you show the codes here.Now I just wonder whether you have time to teach me to write the codes.Maybe I should ask you will you teach me these codes there?I wish I can manage the code myself.

  5. #14
    Member joget is on a distinguished road joget's Avatar
    Join Date
    Feb 2012
    Location
    gresik
    Posts
    365
    Accumulated bonus
    182.1 USD
    Thanks
    3
    Thanked 38 Times in 18 Posts
    great thread, can you make an EA code based on the intersection of the RSI indicator (14, close) with Simple MA indicator (3, previous indicators data). I have tried making it but it does not go as expected because of an error writing the code for Simple MA indicators (3, previous indicators data).

  6. #15
    Member abdul hamid p is an unknown quantity at this point abdul hamid p's Avatar
    Join Date
    May 2012
    Location
    cave
    Posts
    125
    Accumulated bonus
    56.7 USD
    Thanks
    0
    Thanked 2 Times in 2 Posts
    can you make a code for me. i want entry market automatically just when US session. Open BUY when the price above Open Market and Open Sell when the price below Open Market. Stop lose 20 and there is no profit target just close when US session end. thanks

  7. #16
    Senior Member Nabi Ahmed Gill will become famous soon enough Nabi Ahmed Gill's Avatar
    Join Date
    Mar 2012
    Posts
    1,032
    Accumulated bonus
    144.4 USD
    Thanks
    0
    Thanked 71 Times in 55 Posts
    Quote Originally Posted by peteonthenet View Post
    In this thread, we will collect and discuss useful code snippets/functions that we can incorporate in Expert Advisors to make coding process faster and easier
    yar yua mq 4 code ka ha muaja ot es code ka bar main ko pata nahi ha yar ya to main es forum main abi newbie hoon es lya ya forum sa mq4 ka bara main nahi bata sakta hon elsya main es par search karoon ga.

  8. #17
    Senior Member bu'd is an unknown quantity at this point bu'd's Avatar
    Join Date
    May 2012
    Location
    indonesia
    Posts
    130
    Accumulated bonus
    0.3 USD
    Thanks
    0
    Thanked 1 Time in 1 Post
    nice tread.
    Greetings ....
    I want to ask a few examples in MQL4 script, how do I know what the pair are still OP wrote.
    thanks before

  9. #18
    Banned shohel molla is an unknown quantity at this point shohel molla's Avatar
    Join Date
    Jul 2012
    Posts
    192
    Accumulated bonus
    91.95 USD
    Thanks
    22
    Thanked 8 Times in 7 Posts
    It's bollinger Brand MQL Code
    //+------------------------------------------------------------------+
    //| Bollinger MA Price.mq4 |
    //| Paladin80 |
    //| forevex@mail.ru |
    //+------------------------------------------------------------------+
    #property copyright "Paladin80"
    #property link "forevex@mail.ru"

    #property indicator_chart_window
    #property indicator_buffers 3
    #property indicator_color1 LightSeaGreen
    #property indicator_color2 LightSeaGreen
    #property indicator_color3 LightSeaGreen
    //---- indicator parameters
    extern int BandsPeriod=20;
    extern int BandsShift=0;
    extern double BandsDeviations=2.0;
    extern int MA_method=0;
    extern int Applied_price=0;
    bool error=false;
    /* MA_method: 0 - Simple moving average,
    1 - Exponential moving average,
    2 - Smoothed moving average,
    3 - Linear weighted moving average.
    Applied_price: 0 - Close price,
    1 - Open price,
    2 - High price,
    3 - Low price,
    4 - Median price,
    5 - Typical price,
    6 - Weighted close price, */
    //---- buffers
    double MovingBuffer[];
    double UpperBuffer[];
    double LowerBuffer[];

  10. #19
    Banned sumon24 is an unknown quantity at this point sumon24's Avatar
    Join Date
    Jul 2012
    Posts
    15
    Accumulated bonus
    8.1 USD
    Thanks
    1
    Thanked 4 Times in 4 Posts
    I am new in forex .all mention so that helpful for me!! i don't understand u . thanks for this post

    ---------- Post added at 03:47 PM ---------- Previous post was at 03:46 PM ----------

    oh yes I was now save all code and trying to use.

  11. Huracan
  12. #20
    Junior Member nikkoo is an unknown quantity at this point nikkoo's Avatar
    Join Date
    Jul 2012
    Posts
    1
    Accumulated bonus
    0 USD
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nice tread.
    Greetings .
    Last edited by nikkoo; 07-14-2012 at 05:50 AM.

+ Reply to Thread

Tags for this Thread

Posting Permissions

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