Multiple Pending Order sell and buy with price setting and lot setting

 
hi,

i'm looking for script that can set multiple order sell and buy with price setting and lot setting. anyone?


Let say my base price setting 123.44

i want:

1st sell limit to be 30pip from base price setting

2nd sell limit to be 5pip from 1st sell limit

3rd sell limit to be 5pip form 2nd sell limit

4th sell limit to be 5pip form 3rd sell limit

5th sell limit to be 5pip form 4th sell limit

6th sell limit to be 5pip form 5th sell limit

7th sell limit to be 5pip form 6th sell limit

1st buy limit to be 30pip from base price setting

2nd buy limit to be 5pip from 1st buy limit

3rd buy limit to be 5pip from 2nd buy limit

4th buy limit to be 5pip from 3rd buy limit

5th buy limit to be 5pip from 4th buy limit

6th buy limit to be 5pip from 5th buy limit

7th buy limit to be 5pip from 6th buy limit



thank you.

 
saifulnsr:
hi,

i'm looking for script that can set multiple order sell and buy with price setting and lot setting. anyone?


Let say my base price setting 123.44

i want:

1st sell limit to be 30pip from base price setting

2nd sell limit to be 5pip from 1st sell limit

3rd sell limit to be 5pip form 2nd sell limit

4th sell limit to be 5pip form 3rd sell limit

5th sell limit to be 5pip form 4th sell limit

6th sell limit to be 5pip form 5th sell limit

7th sell limit to be 5pip form 6th sell limit

1st buy limit to be 30pip from base price setting

2nd buy limit to be 5pip from 1st buy limit

3rd buy limit to be 5pip from 2nd buy limit

4th buy limit to be 5pip from 3rd buy limit

5th buy limit to be 5pip from 4th buy limit

6th buy limit to be 5pip from 5th buy limit

7th buy limit to be 5pip from 6th buy limit



thank you.

Try this one:

//+------------------------------------------------------------------+
//|                                            MultiPendingOrder.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "https://www.mql5.com/en/users/3rjfx. ~ By 3rjfx ~ Created: 2015/11/20"
#property link      "http://www.mql5.com"
#property link      "https://www.mql5.com/en/users/3rjfx"
#property version   "1.00"
//---
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
     //--
     double pi;
     double lot=0.1;
     //-- Checking the Digits Point
     if(MarketInfo("EURUSD",MODE_DIGITS)==5)
       {
         if(_Digits==2||_Digits==3||_Digits==5) {pi=Point*10;}
         else {pi=Point;}
       }
     else if(MarketInfo("EURUSD",MODE_DIGITS)==4)
       {
         if(_Digits==1) {pi=Point*10;}
         else {pi=Point;}
       }
     //--
     double BuyPrice;
     double BuySL;
     double BuyTP;
     double SellPrice;
     double SellSL;
     double SellTP;
     int maxorder=10;
     double startpips=NormalizeDouble(30*pi,_Digits);
     double addpips=NormalizeDouble(5*pi,_Digits);
     RefreshRates();
     int slip=MarketInfo(_Symbol,MODE_SPREAD);
     double ask=MarketInfo(_Symbol,MODE_ASK);
     double bid=MarketInfo(_Symbol,MODE_BID);
     //--
     for(int i=0; i<maxorder; i++)
       {
         BuyPrice=NormalizeDouble(ask-(startpips+(addpips*i)),_Digits);
         BuySL=NormalizeDouble(BuyPrice-startpips,_Digits);
         BuyTP=NormalizeDouble(BuyPrice+startpips,_Digits);
         int resB=OrderSend(_Symbol,OP_BUYLIMIT,lot,BuyPrice,slip,BuySL,BuyTP,"My_Order",12345,TimeCurrent()+(i*60*60),clrGreen);
         if(resB<0) 
           { 
             Print("OrderSend failed with error #",GetLastError());
             ResetLastError();
             Sleep(1000);
             RefreshRates();
             ask=MarketInfo(_Symbol,MODE_ASK);
             BuyPrice=NormalizeDouble(ask-(startpips+(addpips*i)),_Digits);
             BuySL=NormalizeDouble(BuyPrice-startpips,_Digits);
             BuyTP=NormalizeDouble(BuyPrice+startpips,_Digits);
             resB=OrderSend(_Symbol,OP_BUYLIMIT,lot,BuyPrice,slip,BuySL,BuyTP,"My_Order",12345,TimeCurrent()+(i*60*60),clrGreen);
           } 
         else
           {
             Print("OrderSend placed successfully");
           }
         Sleep(1000);
         RefreshRates();
       }
     //--
     for(i=0; i<maxorder; i++)
       {
         SellPrice=NormalizeDouble(bid+(startpips+(addpips*i)),_Digits);
         SellSL=NormalizeDouble(SellPrice+startpips,_Digits);
         SellTP=NormalizeDouble(SellPrice-startpips,_Digits);
         int resS=OrderSend(_Symbol,OP_SELLLIMIT,lot,SellPrice,slip,SellSL,SellTP,"My_Order",56789,TimeCurrent()+(i*60*60),clrRed);
         if(resS<0) 
           { 
             Print("OrderSend failed with error #",GetLastError());
             ResetLastError();
             Sleep(1000);
             RefreshRates();
             bid=MarketInfo(_Symbol,MODE_BID);
             SellPrice=NormalizeDouble(bid+(startpips+(addpips*i)),_Digits);
             SellSL=NormalizeDouble(SellPrice+startpips,_Digits);
             SellTP=NormalizeDouble(SellPrice-startpips,_Digits);
             resS=OrderSend(_Symbol,OP_SELLLIMIT,lot,SellPrice,slip,SellSL,SellTP,"My_Order",56789,TimeCurrent()+(i*60*60),clrRed);
           } 
         else
           {
             Print("OrderSend placed successfully");
           }
         Sleep(1000);
         RefreshRates();
       }
     //--
     return;
     //--
//---
  }
//+------------------------------------------------------------------+
Files:
 
3rjfx:

Try this one:

that's awesome mann....thanks a lot =)
 
saifulnsr:
that's awesome mann....thanks a lot =)
you're welcome ^_^
 
saifulnsr:
hi,

i'm looking for script that can set multiple order sell and buy with price setting and lot setting. anyone?


Let say my base price setting 123.44

i want:

1st sell limit to be 30pip from base price setting

2nd sell limit to be 5pip from 1st sell limit

3rd sell limit to be 5pip form 2nd sell limit

4th sell limit to be 5pip form 3rd sell limit

5th sell limit to be 5pip form 4th sell limit

6th sell limit to be 5pip form 5th sell limit

7th sell limit to be 5pip form 6th sell limit

1st buy limit to be 30pip from base price setting

2nd buy limit to be 5pip from 1st buy limit

3rd buy limit to be 5pip from 2nd buy limit

4th buy limit to be 5pip from 3rd buy limit

5th buy limit to be 5pip from 4th buy limit

6th buy limit to be 5pip from 5th buy limit

7th buy limit to be 5pip from 6th buy limit



thank you.

are you getting some grid type strategy?
 
3rjfx:

Try this one:

good man :) may i try this ? if you dont mind?
 
Roberto Jacobs:

Try this one:

Hi. Do you have time to modify this script? 
 
Roberto Jacobs:

Try this one:

Hi, 

Im looking for for this order, but for stop order? How we change it the program? 
Reason: