Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||
|
||||
## Source Files
|
||||
- `scalpall.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,74 @@
|
||||
#property copyright "Mokara"
|
||||
#property link "https://www.mql5.com/en/users/mokara"
|
||||
#property description "Scalp All"
|
||||
#property version "1.0"
|
||||
#property script_show_inputs true
|
||||
#define MAGIC 999
|
||||
|
||||
input double rTP = 5; //Take Profit Ratio
|
||||
input double rSL = 10; //Stop Loss Ratio
|
||||
input double vol = 0.1; //Volume
|
||||
input long spread = 20; //Maximum Spread
|
||||
input int count = 0; //Maximum Trades (0 for unlimited)
|
||||
|
||||
enum TRADE
|
||||
{
|
||||
BUY = 0,
|
||||
SELL = 1
|
||||
};
|
||||
|
||||
void OnStart()
|
||||
{
|
||||
MqlTradeRequest tReq = {0};
|
||||
MqlTradeResult tRes = {0};
|
||||
int t = -1, i, d, s, c = 0; //type, index, digits, spread, count
|
||||
double p; //point
|
||||
string n; //symbol name
|
||||
|
||||
for(i = 0; i < SymbolsTotal(true); i++)
|
||||
{
|
||||
n = SymbolName(i, true);
|
||||
s = SymbolInfoInteger(n, SYMBOL_SPREAD);
|
||||
p = SymbolInfoDouble(n, SYMBOL_POINT);
|
||||
d = SymbolInfoInteger(n, SYMBOL_DIGITS);
|
||||
|
||||
if(s > spread) continue; //spread filter
|
||||
MathSrand(GetTickCount());
|
||||
Sleep(MathRand()%100);
|
||||
|
||||
ZeroMemory(tReq);
|
||||
ZeroMemory(tRes);
|
||||
tReq.symbol = n;
|
||||
tReq.volume = vol;
|
||||
tReq.action = TRADE_ACTION_DEAL;
|
||||
tReq.deviation = 5;
|
||||
tReq.magic = MAGIC;
|
||||
|
||||
MathSrand(GetTickCount());
|
||||
t = int(MathRand()%2);
|
||||
switch(t)
|
||||
{
|
||||
case BUY:
|
||||
tReq.type = ORDER_TYPE_BUY;
|
||||
tReq.price = SymbolInfoDouble(n, SYMBOL_ASK);
|
||||
tReq.tp = tReq.price + NormalizeDouble(s * p * rTP, d);
|
||||
tReq.sl = tReq.price - NormalizeDouble(s * p * rSL, d);
|
||||
break;
|
||||
case SELL:
|
||||
tReq.type = ORDER_TYPE_SELL;
|
||||
tReq.price = SymbolInfoDouble(n, SYMBOL_BID);
|
||||
tReq.tp = tReq.price - NormalizeDouble(s * p * rTP, d);
|
||||
tReq.sl = tReq.price + NormalizeDouble(s * p * rSL, d);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!OrderSend(tReq, tRes))
|
||||
{
|
||||
Print("ERROR: order send. Error Code: " + GetLastError());
|
||||
continue;
|
||||
}
|
||||
|
||||
c++;
|
||||
if(c >= count && count != 0) break;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user