-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSignal Browser.mq5
69 lines (60 loc) · 3.36 KB
/
Signal Browser.mq5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2020, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
#property script_show_inputs
input double MinROI=0; //Minimum acceptable ROI
input double MaxDrawDown=10; //Max Acceptable DrawDown
input double MinGain=50; //Min Acceptable Gain
input double MaxPrice=50; //Max Acceptable Price
input datetime StartedBefore="2019.01.01"; //Signals Started on or before
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- get total amount of signals in the terminal
int total=SignalBaseTotal();
PrintFormat("Searching %i Signals for the specified parameters.", total);
int count=0;
//--- process all signals, one by one, to seek what User wants
for(int i=0; i<total; i++)
{
//--- select the signal by index
if(SignalBaseSelect(i))
{
//--- get signal properties
long id =SignalBaseGetInteger(SIGNAL_BASE_ID); // signal id
long pips =SignalBaseGetInteger(SIGNAL_BASE_PIPS); // profit in pips
long subscr=SignalBaseGetInteger(SIGNAL_BASE_SUBSCRIBERS); // number of subscribers
string name =SignalBaseGetString(SIGNAL_BASE_NAME); // signal name
double price =SignalBaseGetDouble(SIGNAL_BASE_PRICE); // signal price
string curr =SignalBaseGetString(SIGNAL_BASE_CURRENCY); // signal currency
double dd =SignalBaseGetDouble(SIGNAL_BASE_MAX_DRAWDOWN); // DrawDown
double roi = SignalBaseGetDouble(SIGNAL_BASE_ROI);
double gain =SignalBaseGetDouble(SIGNAL_BASE_GAIN);
datetime DatePublished=SignalBaseGetInteger(SIGNAL_BASE_DATE_PUBLISHED);
datetime DateStarted =SignalBaseGetInteger(SIGNAL_BASE_DATE_STARTED);
long rating= SignalBaseGetInteger(SIGNAL_BASE_RATING);
int Leverage = SignalBaseGetInteger(SIGNAL_BASE_LEVERAGE);
int Rating = SignalBaseGetInteger(SIGNAL_BASE_RATING);
int TradeMode = SignalBaseGetInteger(SIGNAL_BASE_TRADE_MODE);
double equitylimit=SignalInfoGetDouble(SIGNAL_INFO_EQUITY_LIMIT);
//--- print ONLY screened Signals
if((price<=MaxPrice)&&(curr=="USD")&&(roi>=MinROI)&&(dd<=MaxDrawDown) && (gain>=MinGain) && (DateStarted<=StartedBefore))
{
count=count+1;
Print(count+" Gain="+gain+" roi="+roi+" subs="+subscr+" dd="+dd+" Started "+TimeToString(DateStarted,TIME_DATE)+" - id="+id+" name="+name);
}
}
else
PrintFormat("Error in call of SignalBaseSelect. Error code=%d",GetLastError());
}
}
//+------------------------------------------------------------------+
/*
Simple Script to help Selecting a signal based on parameters.
User will input the parameters and the script will look up the Signals Base, 1 by 1 to find the matches.
*/
//+------------------------------------------------------------------+