a/Ne
3bedo.sy1 b35080ffb6 Updated
تحليل فني و زمني وكلاسيكي مع استخدام الأدوات لاخراج نقطة دخول للبيع او للشراء مع تحديد الستوب لوس و الهدف

Signed-off-by: 3bedo.sy1 <3bedo.sy1@noreply.mql5.com>
2026-10-03 08:08:13 +00:00

811 lines
No EOL
24 KiB
Text

mql5
//+------------------------------------------------------------------+
//| XAUUSD.mq5 |
//| Copyright 2023, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"
#property version "1.00"
#property strict
// Input parameters
input int TimeFrame = PERIOD_M15; // Timeframe
input double LotSize = 0.1; // Lot size
input int StopLossPips = 20; // Stop loss in pips
input int TakeProfitPips = 40; // Take profit in pips
// Global variables
double swingHigh, swingLow;
double liquidityLevel;
double entryPrice;
double stopLossPrice, takeProfitPrice;
bool buySignal = false, sellSignal = false;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0, CHART_TIMEFRAME, TimeFrame);
// Set the lot size
LotSize = NormalizeDouble(LotSize, _Digits);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Clean up any resources if needed
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current price data
double currentPrice = iClose(_Symbol, _Period, 0);
double highPrice = iHigh(_Symbol, _Period, 0);
double lowPrice = iLow(_Symbol, _Period, 0);
// Calculate swing high and swing low
swingHigh = iHigh(_Symbol, _Period, 1);
swingLow = iLow(_Symbol, _Period, 1);
// Calculate liquidity level
liquidityLevel = (highPrice + lowPrice) / 2;
// Check for buy signal
if (currentPrice > swingHigh && currentPrice > liquidityLevel)
{
buySignal = true;
sellSignal = false;
}
// Check for sell signal
if (currentPrice < swingLow && currentPrice < liquidityLevel)
{
sellSignal = true;
buySignal = false;
}
// Calculate entry price, stop loss, and take profit
if (buySignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice - StopLossPips * _Point;
takeProfitPrice = entryPrice + TakeProfitPips * _Point;
}
else if (sellSignal)
{
entryPrice = currentPrice;
stopLossPrice = entryPrice + StopLossPips * _Point;
takeProfitPrice = entryPrice - TakeProfitPips * _Point;
}
// Place orders
if (buySignal)
{
OrderSend(_Symbol, OP_BUY, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Buy Order", 0, 0, clrGreen);
}
else if (sellSignal)
{
OrderSend(_Symbol, OP_SELL, LotSize, entryPrice, 3, stopLossPrice, takeProfitPrice, "Sell Order", 0, 0, clrRed);
}
}
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Set the timeframe for the indicator
ChartSetInteger(0