mirror of
https://github.com/rithsila/MT5-EA-Sniper-Strategy.git
synced 2026-08-15 19:58:12 +00:00
last commit
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| ClosePositions.mqh |
|
||||
//| Copyright 2021, Nkondog Anselme Venceslas |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2021, Nkondog Anselme Venceslas"
|
||||
#property link "https://www.mql5.com"
|
||||
|
||||
CTrade trade;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
bool OrderClose()
|
||||
{
|
||||
bool result = true;
|
||||
int cnt = OrdersTotal();
|
||||
if(cnt == 1)
|
||||
{
|
||||
|
||||
|
||||
for(int i = cnt-1; i>=0; i--)
|
||||
{
|
||||
ulong ticket = OrderGetTicket(i);
|
||||
if(OrderSelect(ticket))
|
||||
{
|
||||
|
||||
result &= trade.OrderDelete(ticket);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Binary file not shown.
@@ -17,16 +17,15 @@ void LotSizeCalculate(double SL=0)
|
||||
if(SL!=0)
|
||||
{
|
||||
double RiskBaseAmount=0;
|
||||
double RiskBase=0;
|
||||
|
||||
//TickValue is the value of the individual price increment for 1 lot of the instrument, expressed in the account currenty
|
||||
double TickValue=SymbolInfoDouble(gSymbol,SYMBOL_TRADE_TICK_VALUE);
|
||||
//Define the base for the risk calculation depending on the parameter chosen
|
||||
if(RiskBase==RISK_BASE_BALANCE)
|
||||
if(InpRiskBase==RISK_BASE_BALANCE)
|
||||
RiskBaseAmount=AccountInfoDouble(ACCOUNT_BALANCE);
|
||||
if(RiskBase==RISK_BASE_EQUITY)
|
||||
if(InpRiskBase==RISK_BASE_EQUITY)
|
||||
RiskBaseAmount=AccountInfoDouble(ACCOUNT_EQUITY);
|
||||
if(RiskBase==RISK_BASE_FREEMARGIN)
|
||||
if(InpRiskBase==RISK_BASE_FREEMARGIN)
|
||||
RiskBaseAmount=AccountInfoDouble(ACCOUNT_FREEMARGIN);
|
||||
|
||||
//Calculate the Position Size
|
||||
|
||||
@@ -93,15 +93,15 @@ struct LastTransaction
|
||||
// Input Section
|
||||
//
|
||||
// Fast moving average
|
||||
input int InpFastPeriods = 10; // Fast periods
|
||||
input int InpFastPeriods = 200; // Fast periods
|
||||
input ENUM_MA_METHOD InpFastMethod = MODE_SMA; // Fast method
|
||||
input ENUM_APPLIED_PRICE InpFastAppliedPrice = PRICE_CLOSE; // Fast price
|
||||
|
||||
// Slow moving average
|
||||
/* Slow moving average
|
||||
input int InpSlowPeriods = 20; // Slow periods
|
||||
input ENUM_MA_METHOD InpSlowMethod = MODE_SMA; // Slow method
|
||||
input ENUM_APPLIED_PRICE InpSlowAppliedPrice = PRICE_CLOSE; // Slow price
|
||||
|
||||
*/
|
||||
input int InpAtrPeriod = 14; // ATR period
|
||||
// Bar numbers for comparison
|
||||
//input int InpBar2 = 2; // Base bar number
|
||||
|
||||
@@ -41,7 +41,7 @@ bool ScanPositions()
|
||||
//If it is a sell order then increment the total count of sell orders
|
||||
if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL)
|
||||
gTotalSellPositions++;
|
||||
|
||||
Print("POSITION_TYPE_BUY ", POSITION_TYPE_BUY, " POSITION_TYPE_SELL ", POSITION_TYPE_SELL, " PositionGetInteger(POSITION_TYPE) ", PositionGetInteger(POSITION_TYPE));
|
||||
//Find what is the open time of the most recent trade and assign it to LastBarTraded
|
||||
//this is necessary to check if we already traded in the current candle
|
||||
if((datetime)PositionGetInteger(POSITION_TIME)>gLastBarTraded || gLastBarTraded==NULL)
|
||||
|
||||
Reference in New Issue
Block a user