Edit Your Comment
Quick multiple buy
Oct 31, 2011 at 14:58
Member Since Oct 31, 2011
2 posts
Its simple forex MT4 soft for free:
'FSS Quick multiple buy' script will be useful for traders who need to quickly open multiple buy positions in Metatrader trading platform.
Inputs:
OrderCount - determine how much positions must be opened;
StopLoss - initial Stop Loss value;
StopLossStep - Stop Loss will be increased by StopLossStep value for every next order. If Stop Loss must be equal for all orders then input 0 for StopLossStep;
TakeProfit - initial Take Profit value;
TakeProfitStep - Take Profit will be increased by TakeProfitStep value for every next order. If Take Profit must be equal for all orders then input 0 for TakeProfitStep;
Lots - lot size;
ECN - if you are usin ECN broker, then select TRUE. If non-ECN broker, then select FALSE. If you are not sure, then leave FALSE.
Comm - comment.
-------------------------------------------------------------------------------
//+------------------------------------------------------------------+
//| FSS quick multiple buy.mq4 |
//| ForexSoftwareShop |
//| https://www.forexsoftwareshop.com |
//+------------------------------------------------------------------+
#property copyright 'ForexSoftwareShop'
#property link 'https://www.forexsoftwareshop.com'
#property show_inputs
#include <stdlib.mqh>
extern int OrderCount = 3;
extern double StopLoss = 0.005;
extern double StopLossStep = 0;
extern double TakeProfit = 0.002;
extern double TakeProfitStep = 0.003;
extern double Lots = 0.01;
extern bool ECN = FALSE;
extern string Comm = 'FSS_quick_multiple_buy';
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int ticket, cnt, error;
ticket = 0;
for(cnt = 0; cnt < OrderCount; cnt++ )
{
RefreshRates();
if (ECN == FALSE) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss, Ask + TakeProfit, Comm, 123654);
if (ticket == -1 || ECN == TRUE)
{
error = GetLastError();
if(error == 130/* INVALID_STOPS */ || ECN == TRUE)
{
ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, Comm, 123654);
if(ticket>0)
{
OrderSelect(ticket, SELECT_BY_TICKET);
if(OrderModify(OrderTicket(), OrderOpenPrice(), Ask - StopLoss, Ask + TakeProfit,0) == FALSE) ticket = -1;
}
if(ticket == -1)
{
error = GetLastError();
Print('Error nr.: ',error,' Error Description: ',ErrorDescription(error));
}
} else Print('Error nr.: ',error,' Error Description: ',ErrorDescription(error));
} // ticket == -1
StopLoss = StopLoss + StopLossStep;
TakeProfit = TakeProfit + TakeProfitStep;
}
//----
return(0);
}
//+------------------------------------------------------------------+
'FSS Quick multiple buy' script will be useful for traders who need to quickly open multiple buy positions in Metatrader trading platform.
Inputs:
OrderCount - determine how much positions must be opened;
StopLoss - initial Stop Loss value;
StopLossStep - Stop Loss will be increased by StopLossStep value for every next order. If Stop Loss must be equal for all orders then input 0 for StopLossStep;
TakeProfit - initial Take Profit value;
TakeProfitStep - Take Profit will be increased by TakeProfitStep value for every next order. If Take Profit must be equal for all orders then input 0 for TakeProfitStep;
Lots - lot size;
ECN - if you are usin ECN broker, then select TRUE. If non-ECN broker, then select FALSE. If you are not sure, then leave FALSE.
Comm - comment.
-------------------------------------------------------------------------------
//+------------------------------------------------------------------+
//| FSS quick multiple buy.mq4 |
//| ForexSoftwareShop |
//| https://www.forexsoftwareshop.com |
//+------------------------------------------------------------------+
#property copyright 'ForexSoftwareShop'
#property link 'https://www.forexsoftwareshop.com'
#property show_inputs
#include <stdlib.mqh>
extern int OrderCount = 3;
extern double StopLoss = 0.005;
extern double StopLossStep = 0;
extern double TakeProfit = 0.002;
extern double TakeProfitStep = 0.003;
extern double Lots = 0.01;
extern bool ECN = FALSE;
extern string Comm = 'FSS_quick_multiple_buy';
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int ticket, cnt, error;
ticket = 0;
for(cnt = 0; cnt < OrderCount; cnt++ )
{
RefreshRates();
if (ECN == FALSE) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss, Ask + TakeProfit, Comm, 123654);
if (ticket == -1 || ECN == TRUE)
{
error = GetLastError();
if(error == 130/* INVALID_STOPS */ || ECN == TRUE)
{
ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, Comm, 123654);
if(ticket>0)
{
OrderSelect(ticket, SELECT_BY_TICKET);
if(OrderModify(OrderTicket(), OrderOpenPrice(), Ask - StopLoss, Ask + TakeProfit,0) == FALSE) ticket = -1;
}
if(ticket == -1)
{
error = GetLastError();
Print('Error nr.: ',error,' Error Description: ',ErrorDescription(error));
}
} else Print('Error nr.: ',error,' Error Description: ',ErrorDescription(error));
} // ticket == -1
StopLoss = StopLoss + StopLossStep;
TakeProfit = TakeProfit + TakeProfitStep;
}
//----
return(0);
}
//+------------------------------------------------------------------+
*Commercial use and spam will not be tolerated, and may result in account termination.
Tip: Posting an image/youtube url will automatically embed it in your post!
Tip: Type the @ sign to auto complete a username participating in this discussion.