Behind The Charts Trading Robot
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «ultimate trader behind the charts cracked mql4.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Этот файл представляет собой торгового советника для MetaTrader 4, написанного на языке MQL4. Советник обрабатывает события OnInit, OnTick, OnTimer, OnTrade и OnChartEvent, что подтверждает его роль как эксперта. В коде присутствуют вызовы торговых функций, таких как OrderSend и OrderCreate, а также работа с виртуальными стопами и управление ордерами. Программа включает механизмы сбора статистики, отложенного выполнения блоков и обработки событий торговли. Настройки позволяют задавать магическое число, параметры для анализа прошлых свечей и минимального движения цены, а также размеры позиций и уровни стоп-лосс и тейк-профит для различных блоков. Советник поддерживает работу с графическими объектами, отображающими статус и спред, и может использоваться в тестере стратегий. Виртуальные стопы реализованы через горизонтальные линии, и их работа отключается в режиме оптимизации. Программа также включает функции для работы с тиками, временем и торговыми операциями, что делает её многофункциональным инструментом для автоматизации торговли на платформе MetaTrader 4.
Настройки программы
| Настройка | Описание |
|---|---|
| Magic Number, kind of... (MagicStart) | Магическое число — Задает магическое число для идентификации ордеров советника. |
| inp27_PastCandlesCount | Количество свечей (блок 27) — Количество прошлых свечей для анализа в блоке 27. |
| inp27_PastPipsMinimum | Минимальные пункты (блок 27) — Минимальное движение цены в пунктах для блока 27. |
| inp27_TrendQuality | Качество тренда (блок 27) — Параметр качества тренда для блока 27. |
| inp28_PastCandlesCount | Количество свечей (блок 28) — Количество прошлых свечей для анализа в блоке 28. |
| inp28_PastPipsMinimum | Минимальные пункты (блок 28) — Минимальное движение цены в пунктах для блока 28. |
| inp28_TrendQuality | Качество тренда (блок 28) — Параметр качества тренда для блока 28. |
| inp29_VolumeSize | Объем (блок 29) — Размер торгового объема для блока 29. |
| inp29_StopLossPips | Стоп-лосс в пунктах (блок 29) — Размер стоп-лосса в пунктах для блока 29. |
| inp29_TakeProfitPips | Тейк-профит в пунктах (блок 29) — Размер тейк-профита в пунктах для блока 29. |
| inp35_VolumeSize | Объем (блок 35) — Размер торгового объема для блока 35. |
| inp35_StopLossPips | Стоп-лосс в пунктах (блок 35) — Размер стоп-лосса в пунктах для блока 35. |
| inp35_TakeProfitPips | Тейк-профит в пунктах (блок 35) — Размер тейк-профита в пунктах для блока 35. |
| inp38_VolumeSize | Объем (блок 38) — Размер торгового объема для блока 38. |
| inp38_StopLossPips | Стоп-лосс в пунктах (блок 38) — Размер стоп-лосса в пунктах для блока 38. |
| inp38_TakeProfitPips | Тейк-профит в пунктах (блок 38) — Размер тейк-профита в пунктах для блока 38. |
| inp40_VolumeSize | Объем (блок 40) — Размер торгового объема для блока 40. |
| inp40_StopLossPips | Стоп-лосс в пунктах (блок 40) — Размер стоп-лосса в пунктах для блока 40. |
| inp40_TakeProfitPips | Тейк-профит в пунктах (блок 40) — Размер тейк-профита в пунктах для блока 40. |
| inp113_ObjCorner | Угол объекта — Определяет угол графика для отображения объектов советника. |
| inp292_VolumeSize | Объем (блок 292) — Размер торгового объема для блока 292. |
| inp292_StopLossPips | Стоп-лосс в пунктах (блок 292) — Размер стоп-лосса в пунктах для блока 292. |
| inp292_TakeProfitPips | Тейк-профит в пунктах (блок 292) — Размер тейк-профита в пунктах для блока 292. |
| inp296_VolumeSize | Объем (блок 296) — Размер торгового объема для блока 296. |
| inp296_StopLossPips | Стоп-лосс в пунктах (блок 296) — Размер стоп-лосса в пунктах для блока 296. |
| inp296_TakeProfitPips | Тейк-профит в пунктах (блок 296) — Размер тейк-профита в пунктах для блока 296. |
Поиск по коду файла
#property description "Created By ClassicForexTrader"
#property version "WhatsApp +27680536880"
#property strict
#define PROJECT_ID "mt4-1823"
#define POINT_FORMAT_RULES "0.001=0.01,0.00001=0.0001,0.000001=0.0001" // this is deserialized in a special function later
#define ENABLE_SPREAD_METER false
#define ENABLE_STATUS true
#define ENABLE_TEST_INDICATORS true
#define ENABLE_EVENT_TICK 1 // enable "Tick" event
#define ENABLE_EVENT_TRADE 1 // enable "Trade" event
#define ENABLE_EVENT_TIMER 0 // enable "Timer" event
#define VIRTUAL_STOPS_ENABLED 0 // enable virtual stops
#define VIRTUAL_STOPS_TIMEOUT 0 // virtual stops timeout
#define USE_EMERGENCY_STOPS "no" // "yes" to use emergency (hard stops) when virtual stops are in use. "always" to use EMERGENCY_STOPS_ADD as emergency stops when there is no virtual stop.
#define EMERGENCY_STOPS_REL 0 // use 0 to disable hard stops when virtual stops are enabled. Use a value >=0 to automatically set hard stops with virtual. Example: if 2 is used, then hard stops will be 2 times bigger than virtual ones.
#define EMERGENCY_STOPS_ADD 0 // add pips to relative size of emergency stops (hard stops)
#define ON_TRADE_REALTIME 0 //
#define ON_TIMER_PERIOD 60 // Timer event period (in seconds)
string fxdBlocksLookupTable[];
#define TLOBJPROP_TIME1 801
#define OBJPROP_TL_PRICE_BY_SHIFT 802
#define OBJPROP_TL_SHIFT_BY_PRICE 803
#define OBJPROP_FIBOVALUE 804
#define OBJPROP_FIBOPRICEVALUE 805
#define OBJPROP_BARSHIFT1 807
#define OBJPROP_BARSHIFT2 808
#define OBJPROP_BARSHIFT3 809
#define SEL_CURRENT 0
#define SEL_INITIAL 1
input int MagicStart = 6730; // Magic Number, kind of...
class c
{
public:
static int MagicStart;
};
int c::MagicStart;
class v
{
public:
static double Acc_No;
};
double v::Acc_No;
input int inp27_PastCandlesCount = 60;
input double inp27_PastPipsMinimum = 1.0;
input double inp27_TrendQuality = 7.0;
input int inp28_PastCandlesCount = 60;
input double inp28_PastPipsMinimum = 1.0;
input double inp28_TrendQuality = 7.0;
input double inp29_VolumeSize = 0.01;
input double inp29_StopLossPips = 20.0;
input double inp29_TakeProfitPips = 10.0;
input double inp35_VolumeSize = 0.01;
input double inp35_StopLossPips = 20.0;
input double inp35_TakeProfitPips = 10.0;
input double inp38_VolumeSize = 0.01;
input double inp38_StopLossPips = 20.0;
input double inp38_TakeProfitPips = 10.0;
input double inp40_VolumeSize = 0.01;
input double inp40_StopLossPips = 20.0;
input double inp40_TakeProfitPips = 10.0;
input int inp113_ObjCorner = CORNER_RIGHT_UPPER;
input double inp292_VolumeSize = 0.01;
input double inp292_StopLossPips = 20.0;
input double inp292_TakeProfitPips = 5.0;
input double inp296_VolumeSize = 0.01;
input double inp296_StopLossPips = 20.0;
input double inp296_TakeProfitPips = 5.0;
class _externs
{
public:
static int inp27_PastCandlesCount;
static double inp27_PastPipsMinimum;
static double inp27_TrendQuality;
static int inp28_PastCandlesCount;
static double inp28_PastPipsMinimum;
static double inp28_TrendQuality;
static double inp29_VolumeSize;
static double inp29_StopLossPips;
static double inp29_TakeProfitPips;
static double inp35_VolumeSize;
static double inp35_StopLossPips;
static double inp35_TakeProfitPips;
static double inp38_VolumeSize;
static double inp38_StopLossPips;
static double inp38_TakeProfitPips;
static double inp40_VolumeSize;
static double inp40_StopLossPips;
static double inp40_TakeProfitPips;
static int inp113_ObjCorner;
static double inp292_VolumeSize;
static double inp292_StopLossPips;
static double inp292_TakeProfitPips;
static double inp296_VolumeSize;
static double inp296_StopLossPips;
static double inp296_TakeProfitPips;
};
int _externs::inp27_PastCandlesCount;
double _externs::inp27_PastPipsMinimum;
double _externs::inp27_TrendQuality;
int _externs::inp28_PastCandlesCount;
double _externs::inp28_PastPipsMinimum;
double _externs::inp28_TrendQuality;
double _externs::inp29_VolumeSize;
double _externs::inp29_StopLossPips;
double _externs::inp29_TakeProfitPips;
double _externs::inp35_VolumeSize;
double _externs::inp35_StopLossPips;
double _externs::inp35_TakeProfitPips;
double _externs::inp38_VolumeSize;
double _externs::inp38_StopLossPips;
double _externs::inp38_TakeProfitPips;
double _externs::inp40_VolumeSize;
double _externs::inp40_StopLossPips;
double _externs::inp40_TakeProfitPips;
int _externs::inp113_ObjCorner;
double _externs::inp292_VolumeSize;
double _externs::inp292_StopLossPips;
double _externs::inp292_TakeProfitPips;
double _externs::inp296_VolumeSize;
double _externs::inp296_StopLossPips;
double _externs::inp296_TakeProfitPips;
int FXD_CURRENT_FUNCTION_ID = 0;
double FXD_MILS_INIT_END = 0;
int FXD_TICKS_FROM_START = 0;
int FXD_MORE_SHIFT = 0;
bool FXD_DRAW_SPREAD_INFO = false;
bool FXD_FIRST_TICK_PASSED = false;
bool FXD_BREAK = false;
bool FXD_CONTINUE = false;
bool FXD_CHART_IS_OFFLINE = false;
bool FXD_ONTIMER_TAKEN = false;
bool FXD_ONTIMER_TAKEN_IN_MILLISECONDS = false;
double FXD_ONTIMER_TAKEN_TIME = 0;
bool USE_VIRTUAL_STOPS = VIRTUAL_STOPS_ENABLED;
string FXD_CURRENT_SYMBOL = "";
int FXD_BLOCKS_COUNT = 66;
datetime FXD_TICKSKIP_UNTIL = 0;
struct fxd_onchart
{
int id;
long lparam;
double dparam;
string sparam;
};
fxd_onchart FXD_ONCHART;
/************************************************************************************************************************/
/************************************************************************************************************************/
int OnInit()
{
// код доступен только после оплаты
}
void OnTick()
{
// код доступен только после оплаты
}
void OnTrade()
{
if (false) OnTradeEventDetector * dummy = new OnTradeEventDetector();
if (onTradeEventDetector.Start() == true)
{
int blocks_to_run[] = {54,59};
for (int i=0; i<ArraySize(blocks_to_run); i++) {
_blocks_[blocks_to_run[i]].run();
}
}
onTradeEventDetector.End();
}
void OnTimer()
{
if (FXD_CHART_IS_OFFLINE && RefreshRates()) {
OnTick();
}
if (ON_TRADE_REALTIME == 1) {
OnTrade();
}
static datetime t0 = 0;
datetime t = 0;
bool ok = false;
if (FXD_ONTIMER_TAKEN)
{
if (FXD_ONTIMER_TAKEN_TIME > 0)
{
if (FXD_ONTIMER_TAKEN_IN_MILLISECONDS == true)
{
t = GetTickCount();
}
else
{
t = TimeLocal();
}
if ((t - t0) >= FXD_ONTIMER_TAKEN_TIME)
{
t0 = t;
ok = true;
}
}
if (ok == false) {
return;
}
}
}
void OnChartEvent(
const int id, // Event ID
const long& lparam, // Parameter of type long event
const double& dparam, // Parameter of type double event
const string& sparam // Parameter of type string events
)
{
FXD_ONCHART.id = id;
FXD_ONCHART.lparam = lparam;
FXD_ONCHART.dparam = dparam;
FXD_ONCHART.sparam = sparam;
return;
}
void OnDeinit(const int reason)
{
int reson = UninitializeReason();
if (reson == REASON_CHARTCHANGE || reson == REASON_PARAMETERS || reason == REASON_TEMPLATE) {return;}
EventKillTimer();
if (ENABLE_STATUS) DrawStatus("stopped");
if (ENABLE_SPREAD_METER) DrawSpreadInfo();
if (MQLInfoInteger(MQL_TESTER)) {
Print("Backtested in "+DoubleToString((GetTickCount()-FXD_MILS_INIT_END)/1000, 2)+" seconds");
double tc = GetTickCount()-FXD_MILS_INIT_END;
if (tc > 0)
{
Print("Average ticks per second: "+DoubleToString(FXD_TICKS_FROM_START/tc, 0));
}
}
if (MQLInfoInteger(MQL_PROGRAM_TYPE) == PROGRAM_EXPERT)
{
switch(UninitializeReason())
{
case REASON_PROGRAM : Print("Expert Advisor self terminated"); break;
case REASON_REMOVE : Print("Expert Advisor removed from the chart"); break;
case REASON_RECOMPILE : Print("Expert Advisor has been recompiled"); break;
case REASON_CHARTCHANGE : Print("Symbol or chart period has been changed"); break;
case REASON_CHARTCLOSE : Print("Chart has been closed"); break;
case REASON_PARAMETERS : Print("Input parameters have been changed by a user"); break;
case REASON_ACCOUNT : Print("Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings"); break;
case REASON_TEMPLATE : Print("A new template has been applied"); break;
case REASON_INITFAILED : Print("OnInit() handler has returned a nonzero value"); break;
case REASON_CLOSE : Print("Terminal has been closed"); break;
}
}
for (int i=0; i<ArraySize(_blocks_); i++)
{
delete _blocks_[i];
_blocks_[i] = NULL;
}
ArrayResize(_blocks_, 0);
return;
}
/************************************************************************************************************************/
/************************************************************************************************************************/
/**
The base class for all block calls
*/
class BlockCalls
{
public:
bool __disabled; // whether or not the block is disabled
string __block_user_number;
int __block_number;
int __block_waiting;
int __parent_number;
int __inbound_blocks[];
int __outbound_blocks[];
void __addInboundBlock(int id = 0) {
int size = ArraySize(__inbound_blocks);
for (int i = 0; i < size; i++) {
if (__inbound_blocks[i] == id) {
return;
}
}
ArrayResize(__inbound_blocks, size + 1);
__inbound_blocks[size] = id;
}
void BlockCalls() {
__disabled = false;
__block_user_number = "";
__block_number = 0;
__block_waiting = 0;
__parent_number = 0;
}
/**
Announce this block to the list of inbound connections of all the blocks to which this block is connected to
*/
void __announceThisBlock()
{
for (int i = 0; i < ArraySize(__outbound_blocks); i++)
{
int block = __outbound_blocks[i]; // outbound block number
int size = ArraySize(_blocks_[block].__inbound_blocks); // the size of its inbound list
for (int j = 0; j < size; j++) {
if (_blocks_[block].__inbound_blocks[j] == __block_number)
{
return;
}
}
ArrayResize(_blocks_[block].__inbound_blocks, size + 1);
_blocks_[block].__inbound_blocks[size] = __block_number;
}
}
virtual void _execute_() = 0;
/**
In the derived class this method should be used to set dynamic parameters or other stuff before the main execute.
This method is automatically called within the main "run" method below, before the execution of the main class.
*/
virtual void _beforeExecute_() {return;};
bool _beforeExecuteEnabled; // for speed
/**
Same as _beforeExecute_, but to work after the execute method.
*/
virtual void _afterExecute_() {return;};
bool _afterExecuteEnabled; // for speed
/**
This is the method that is used to run the block
*/
virtual void run(int _parent_=0) {
__parent_number = _parent_;
if (__disabled || FXD_BREAK) {return;}
FXD_CURRENT_FUNCTION_ID = __block_number;
if (_beforeExecuteEnabled) {_beforeExecute_();}
_execute_();
if (_afterExecuteEnabled) {_afterExecute_();}
if (__block_waiting && FXD_CURRENT_FUNCTION_ID == __block_number) {fxdWait.Accumulate(FXD_CURRENT_FUNCTION_ID);}
}
};
BlockCalls *_blocks_[];
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename T10,typename T11,typename T12,typename T13,typename T14,typename T15,typename T16,typename T17,typename T18>
class MDL_ChartSetProperties: public BlockCalls
{
public: /* Input Parameters */
T1 ChartMode;
T2 ChartOnForeground;
T3 ChartShift;
T4 ChartAutoScroll;
T5 ChartScale;
T6 ChartShowOHLC;
T7 ChartShowBidLine;
T8 ChartShowAskLine;
T9 ChartShowLastLine;
T10 ChartShowPeriodSeparators;
T11 ChartShowGrid;
T12 ChartShowVolumes;
T13 ChartShowDescriptions;
T14 ChartShowTradeLevels;
T15 ChartShowDateScale;
T16 ChartShowPriceScale;
T17 ChartScaleFix11;
T18 ChartScaleFix;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_ChartSetProperties()
{
ChartMode = (int)-1;
ChartOnForeground = (int)-1;
ChartShift = (int)-1;
ChartAutoScroll = (int)-1;
ChartScale = (int)-1;
ChartShowOHLC = (int)-1;
ChartShowBidLine = (int)-1;
ChartShowAskLine = (int)-1;
ChartShowLastLine = (int)-1;
ChartShowPeriodSeparators = (int)-1;
ChartShowGrid = (int)-1;
ChartShowVolumes = (int)-1;
ChartShowDescriptions = (int)-1;
ChartShowTradeLevels = (int)-1;
ChartShowDateScale = (int)-1;
ChartShowPriceScale = (int)-1;
ChartScaleFix11 = (int)-1;
ChartScaleFix = (int)-1;
}
public: /* The main method */
virtual void _execute_()
{
ResetLastError();
if (ChartMode!=-1) {
if(!ChartSetInteger(0,CHART_MODE,ChartMode)) {Print("Unable to set chart mode. Error code: ",GetLastError());}
}
if (ChartOnForeground!=-1) {
if(!ChartSetInteger(0,CHART_FOREGROUND,ChartOnForeground)) {Print("Unable to set chart foreground mode. Error code: ",GetLastError());}
}
if (ChartShift!=-1) {
if(!ChartSetInteger(0,CHART_SHIFT,ChartShift)) {Print("Unable to set chart shift mode. Error code: ",GetLastError());}
}
if (ChartAutoScroll!=-1) {
if(!ChartSetInteger(0,CHART_AUTOSCROLL,ChartAutoScroll)) {Print("Unable to set chart autoscroll mode. Error code: ",GetLastError());}
}
if (ChartScale!=-1) {
if(!ChartSetInteger(0,CHART_SCALE,ChartScale)) {Print("Unable to set chart scale mode. Error code: ",GetLastError());}
}
if (ChartShowOHLC!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_OHLC,ChartShowOHLC)) {Print("Unable to set chart OHLC mode. Error code: ",GetLastError());}
}
if (ChartShowBidLine!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_BID_LINE,ChartShowBidLine)) {Print("Unable to set chart Bid price line mode. Error code: ",GetLastError());}
}
if (ChartShowAskLine!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_ASK_LINE,ChartShowAskLine)) {Print("Unable to set chart Ask price line mode. Error code: ",GetLastError());}
}
if (ChartShowLastLine!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_LAST_LINE,ChartShowLastLine)) {Print("Unable to set chart last price line mode. Error code: ",GetLastError());}
}
if (ChartShowPeriodSeparators!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_PERIOD_SEP,ChartShowPeriodSeparators)) {Print("Unable to set chart period separators mode. Error code: ",GetLastError());}
}
if (ChartShowGrid!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_GRID,ChartShowGrid)) {Print("Unable to set chart grid mode. Error code: ",GetLastError());}
}
if (ChartShowVolumes!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_VOLUMES,ChartShowVolumes)) {Print("Unable to set chart volumes mode. Error code: ",GetLastError());}
}
if (ChartShowDescriptions!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_OBJECT_DESCR,ChartShowDescriptions)) {Print("Unable to set chart object descriptions mode. Error code: ",GetLastError());}
}
if (ChartShowTradeLevels!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_TRADE_LEVELS,ChartShowTradeLevels)) {Print("Unable to set chart trade levels mode. Error code: ",GetLastError());}
}
if (ChartShowDateScale!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_DATE_SCALE,ChartShowDateScale)) {Print("Unable to set chart date scale mode. Error code: ",GetLastError());}
}
if (ChartShowPriceScale!=-1) {
if(!ChartSetInteger(0,CHART_SHOW_PRICE_SCALE,ChartShowPriceScale)) {Print("Unable to set chart price scale mode. Error code: ",GetLastError());}
}
if (ChartScaleFix!=-1) {
if(!ChartSetInteger(0,CHART_SCALEFIX,ChartScaleFix)) {Print("Unable to set scale fix One to One. Error code: ",GetLastError());}
}
else {
if (ChartScaleFix11!=-1) {
if(!ChartSetInteger(0,CHART_SCALEFIX_11,ChartScaleFix11)) {Print("Unable to set scale fix One to One. Error code: ",GetLastError());}
}
}
ChartRedraw();
_callback_(1);
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename T10,typename T11,typename T12,typename T13>
class MDL_ChartSetColors: public BlockCalls
{
public: /* Input Parameters */
T1 ChartColorBackground;
T2 ChartColorForeground;
T3 ChartColorGrid;
T4 ChartColorBarUp;
T5 ChartColorBarDown;
T6 ChartColorBullCandle;
T7 ChartColorBearCandle;
T8 ChartColorDojiCandle;
T9 ChartColorVolumes;
T10 ChartColorBid;
T11 ChartColorAsk;
T12 ChartColorLast;
T13 ChartColorStopLevels;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_ChartSetColors()
{
ChartColorBackground = (color)clrBlack;
ChartColorForeground = (color)clrWhite;
ChartColorGrid = (color)clrLightSlateGray;
ChartColorBarUp = (color)clrLime;
ChartColorBarDown = (color)clrLime;
ChartColorBullCandle = (color)clrBlack;
ChartColorBearCandle = (color)clrWhite;
ChartColorDojiCandle = (color)clrLime;
ChartColorVolumes = (color)clrLimeGreen;
ChartColorBid = (color)clrLightSlateGray;
ChartColorAsk = (color)clrRed;
ChartColorLast = (color)clrLimeGreen;
ChartColorStopLevels = (color)clrRed;
}
public: /* The main method */
virtual void _execute_()
{
ResetLastError();
if (ChartColorBackground!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_BACKGROUND,ChartColorBackground)) {Print("Unable to set chart background color. Error code: ",GetLastError());}
}
if (ChartColorForeground!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_FOREGROUND,ChartColorForeground)) {Print("Unable to set chart foreground color. Error code: ",GetLastError());}
}
if (ChartColorGrid!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_GRID,ChartColorGrid)) {Print("Unable to set chart grid color. Error code: ",GetLastError());}
}
if (ChartColorBarUp!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_CHART_UP,ChartColorBarUp)) {Print("Unable to set chart bar up color. Error code: ",GetLastError());}
}
if (ChartColorBarDown!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_CHART_DOWN,ChartColorBarDown)) {Print("Unable to set chart bar down color. Error code: ",GetLastError());}
}
if (ChartColorBullCandle!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,ChartColorBullCandle)) {Print("Unable to set chart bull candle color. Error code: ",GetLastError());}
}
if (ChartColorBearCandle!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,ChartColorBearCandle)) {Print("Unable to set chart bear candle color. Error code: ",GetLastError());}
}
if (ChartColorDojiCandle!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_CHART_LINE,ChartColorDojiCandle)) {Print("Unable to set chart doji candle color. Error code: ",GetLastError());}
}
if (ChartColorVolumes!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_VOLUME,ChartColorVolumes)) {Print("Unable to set chart volumes color. Error code: ",GetLastError());}
}
if (ChartColorBid!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_BID,ChartColorBid)) {Print("Unable to set chart Bid line color. Error code: ",GetLastError());}
}
if (ChartColorAsk!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_ASK,ChartColorAsk)) {Print("Unable to set chart Ask line color. Error code: ",GetLastError());}
}
if (ChartColorLast!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_LAST,ChartColorLast)) {Print("Unable to set chart last price line color. Error code: ",GetLastError());}
}
if (ChartColorStopLevels!=clrNONE) {
if(!ChartSetInteger(0,CHART_COLOR_STOP_LEVEL,ChartColorStopLevels)) {Print("Unable to set chart stop levels color. Error code: ",GetLastError());}
}
ChartRedraw();
_callback_(1);
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5>
class MDL_NoOpenedOrders: public BlockCalls
{
public: /* Input Parameters */
T1 GroupMode;
T2 Group;
T3 SymbolMode;
T4 Symbol;
T5 BuysOrSells;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_NoOpenedOrders()
{
GroupMode = (string)"group";
Group = (string)"";
SymbolMode = (string)"symbol";
Symbol = (string)CurrentSymbol();
BuysOrSells = (string)"both";
}
public: /* The main method */
virtual void _execute_()
{
bool exist = false;
for (int index = TradesTotal()-1; index >= 0; index--)
{
if (TradeSelectByIndex(index, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
exist = true;
break;
}
}
if (exist == false) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7>
class MDL_CheckTradesCount: public BlockCalls
{
public: /* Input Parameters */
T1 Compare;
T2 CompareCount;
T3 GroupMode;
T4 Group;
T5 SymbolMode;
T6 Symbol;
T7 BuysOrSells;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_CheckTradesCount()
{
Compare = (string)">";
CompareCount = (int)3;
GroupMode = (string)"group";
Group = (string)"";
SymbolMode = (string)"symbol";
Symbol = (string)CurrentSymbol();
BuysOrSells = (string)"both";
}
public: /* The main method */
virtual void _execute_()
{
int count = 0;
for (int index = TradesTotal()-1; index >= 0; index--)
{
if (TradeSelectByIndex(index, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
count++;
}
}
if (compare(Compare, count, CompareCount)) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6>
class MDL_NewTopInTrend: public BlockCalls
{
public: /* Input Parameters */
T1 SignalType;
T2 PastCandlesCount;
T3 PastPipsMinimum;
T4 TrendQuality;
T5 Symbol;
T6 Period;
/* Static Parameters */
datetime bartime;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_NewTopInTrend()
{
SignalType = (string)"continuous";
PastCandlesCount = (int)10;
PastPipsMinimum = (double)50.0;
TrendQuality = (double)8.0;
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
/* Static Parameters (initial value) */
bartime = 0;
}
public: /* The main method */
virtual void _execute_()
{
int i = 0;
bool gofurther = true;
bool pass = false;
double OldestCandleLow = iLow(Symbol,Period,PastCandlesCount);
for (i=0; i < PastCandlesCount; i++)
{
if (iHigh(Symbol,Period,i) > iClose(Symbol,Period,0))
{
gofurther = false;
}
}
for (i=0; i < PastCandlesCount; i++)
{
if (TrendQuality < 1) {TrendQuality = 1;}
else if (TrendQuality > 9) {TrendQuality = 9;}
if ((iLow(Symbol,Period,PastCandlesCount)-iLow(Symbol,Period,i)) >= toDigits(PastPipsMinimum, Symbol)*(100-(TrendQuality*10))/100)
{
gofurther = false;
}
}
if (gofurther == true && (SignalType == "continuous" || bartime < iTime(Symbol,Period,0)))
{
if (iClose(Symbol,Period,0) >= OldestCandleLow + toDigits(PastPipsMinimum, Symbol))
{
if (SignalType != "continuous")
{
bartime = iTime(Symbol,Period,0);
}
pass = true;
}
}
if (pass == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6>
class MDL_NewBottomInTrend: public BlockCalls
{
public: /* Input Parameters */
T1 SignalType;
T2 PastCandlesCount;
T3 PastPipsMinimum;
T4 TrendQuality;
T5 Symbol;
T6 Period;
/* Static Parameters */
datetime bartime;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_NewBottomInTrend()
{
SignalType = (string)"continuous";
PastCandlesCount = (int)10;
PastPipsMinimum = (double)50.0;
TrendQuality = (double)7.5;
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
/* Static Parameters (initial value) */
bartime = 0;
}
public: /* The main method */
virtual void _execute_()
{
int i = 0;
bool gofurther = true;
bool pass = false;
double OldestCandleHigh = iHigh(Symbol,Period,PastCandlesCount);
for (i=0; i < PastCandlesCount; i++)
{
if (iLow(Symbol,Period,i) < iClose(Symbol,Period,0))
{
gofurther = false;
}
}
for (i=0; i < PastCandlesCount; i++)
{
if (TrendQuality < 1) {TrendQuality = 1;}
else if (TrendQuality > 9) {TrendQuality = 9;}
if ((iHigh(Symbol,Period,i)-iHigh(Symbol,Period,PastCandlesCount)) >= toDigits(PastPipsMinimum, Symbol)*(100-(TrendQuality*10))/100)
{
gofurther = false;
}
}
if (gofurther == true && (SignalType == "continuous" || bartime < iTime(Symbol,Period,0)))
{
if (iClose(Symbol,Period,0) <= OldestCandleHigh - toDigits(PastPipsMinimum, Symbol))
{
if (SignalType != "continuous")
{
bartime = iTime(Symbol,Period,0);
}
pass = true;
}
}
if (pass == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename _T9_,typename T10,typename T11,typename T12,typename T13,typename T14,typename T15,typename T16,typename T17,typename T18,typename T19,typename T20,typename T21,typename T22,typename T23,typename T24,typename T25,typename T26,typename T27,typename T28,typename T29,typename T30,typename T31,typename T32,typename T33,typename T34,typename T35,typename T36,typename T37,typename _T37_,typename T38,typename _T38_,typename T39,typename _T39_,typename T40,typename T41,typename T42,typename T43,typename T44,typename _T44_,typename T45,typename _T45_,typename T46,typename _T46_,typename T47,typename T48,typename T49,typename T50,typename T51,typename _T51_,typename T52,typename T53,typename T54>
class MDL_BuyNow: public BlockCalls
{
public: /* Input Parameters */
T1 Group;
T2 Symbol;
T3 VolumeMode;
T4 VolumeSize;
T5 VolumeSizeRisk;
T6 VolumeRisk;
T7 VolumePercent;
T8 VolumeBlockPercent;
T9 dVolumeSize; virtual _T9_ _dVolumeSize_(){return(_T9_)0;}
T10 FixedRatioUnitSize;
T11 FixedRatioDelta;
T12 mmTradesPool;
T13 mmMgInitialLots;
T14 mmMgMultiplyOnLoss;
T15 mmMgMultiplyOnProfit;
T16 mmMgAddLotsOnLoss;
T17 mmMgAddLotsOnProfit;
T18 mmMgResetOnLoss;
T19 mmMgResetOnProfit;
T20 mm1326InitialLots;
T21 mm1326Reverse;
T22 mmFiboInitialLots;
T23 mmDalembertInitialLots;
T24 mmDalembertReverse;
T25 mmLabouchereInitialLots;
T26 mmLabouchereList;
T27 mmLabouchereReverse;
T28 mmSeqBaseLots;
T29 mmSeqOnLoss;
T30 mmSeqOnProfit;
T31 mmSeqReverse;
T32 VolumeUpperLimit;
T33 StopLossMode;
T34 StopLossPips;
T35 StopLossPercentPrice;
T36 StopLossPercentTP;
T37 dlStopLoss; virtual _T37_ _dlStopLoss_(){return(_T37_)0;}
T38 dpStopLoss; virtual _T38_ _dpStopLoss_(){return(_T38_)0;}
T39 ddStopLoss; virtual _T39_ _ddStopLoss_(){return(_T39_)0;}
T40 TakeProfitMode;
T41 TakeProfitPips;
T42 TakeProfitPercentPrice;
T43 TakeProfitPercentSL;
T44 dlTakeProfit; virtual _T44_ _dlTakeProfit_(){return(_T44_)0;}
T45 dpTakeProfit; virtual _T45_ _dpTakeProfit_(){return(_T45_)0;}
T46 ddTakeProfit; virtual _T46_ _ddTakeProfit_(){return(_T46_)0;}
T47 ExpMode;
T48 ExpDays;
T49 ExpHours;
T50 ExpMinutes;
T51 dExp; virtual _T51_ _dExp_(){return(_T51_)0;}
T52 Slippage;
T53 MyComment;
T54 ArrowColorBuy;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_BuyNow()
{
Group = (string)"";
Symbol = (string)CurrentSymbol();
VolumeMode = (string)"fixed";
VolumeSize = (double)0.1;
VolumeSizeRisk = (double)50.0;
VolumeRisk = (double)2.5;
VolumePercent = (double)100.0;
VolumeBlockPercent = (double)3.0;
FixedRatioUnitSize = (double)0.01;
FixedRatioDelta = (double)20.0;
mmTradesPool = (int)0;
mmMgInitialLots = (double)0.1;
mmMgMultiplyOnLoss = (double)2.0;
mmMgMultiplyOnProfit = (double)1.0;
mmMgAddLotsOnLoss = (double)0.0;
mmMgAddLotsOnProfit = (double)0.0;
mmMgResetOnLoss = (int)0;
mmMgResetOnProfit = (int)1;
mm1326InitialLots = (double)0.1;
mm1326Reverse = (bool)false;
mmFiboInitialLots = (double)0.1;
mmDalembertInitialLots = (double)0.1;
mmDalembertReverse = (bool)false;
mmLabouchereInitialLots = (double)0.1;
mmLabouchereList = (string)"1,2,3,4,5,6";
mmLabouchereReverse = (bool)false;
mmSeqBaseLots = (double)0.1;
mmSeqOnLoss = (string)"3,2,6";
mmSeqOnProfit = (string)"1";
mmSeqReverse = (bool)false;
VolumeUpperLimit = (double)0.0;
StopLossMode = (string)"fixed";
StopLossPips = (double)50.0;
StopLossPercentPrice = (double)0.55;
StopLossPercentTP = (double)100.0;
TakeProfitMode = (string)"fixed";
TakeProfitPips = (double)50.0;
TakeProfitPercentPrice = (double)0.55;
TakeProfitPercentSL = (double)100.0;
ExpMode = (string)"GTC";
ExpDays = (int)0;
ExpHours = (int)1;
ExpMinutes = (int)0;
Slippage = (ulong)4;
MyComment = (string)"";
ArrowColorBuy = (color)clrBlue;
}
public: /* The main method */
virtual void _execute_()
{
double sll = 0, slp = 0, tpl = 0, tpp = 0;
if (StopLossMode == "fixed") {slp = StopLossPips;}
else if (StopLossMode == "dynamicPips") {slp = _dpStopLoss_();}
else if (StopLossMode == "dynamicDigits") {slp = toPips(_ddStopLoss_(),Symbol);}
else if (StopLossMode == "dynamicLevel") {sll = _dlStopLoss_();}
else if (StopLossMode == "percentPrice") {sll = SymbolAsk(Symbol) - (SymbolAsk(Symbol) * StopLossPercentPrice / 100);}
if (TakeProfitMode == "fixed") {tpp = TakeProfitPips;}
else if (TakeProfitMode == "dynamicPips") {tpp = _dpTakeProfit_();}
else if (TakeProfitMode == "dynamicDigits") {tpp = toPips(_ddTakeProfit_(),Symbol);}
else if (TakeProfitMode == "dynamicLevel") {tpl = _dlTakeProfit_();}
else if (TakeProfitMode == "percentPrice") {tpl = SymbolAsk(Symbol) + (SymbolAsk(Symbol) * TakeProfitPercentPrice / 100);}
if (StopLossMode == "percentTP") {
if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
if (tpl > 0) {slp = toPips(MathAbs(SymbolAsk(Symbol) - tpl), Symbol)*StopLossPercentTP/100;}
}
if (TakeProfitMode == "percentSL") {
if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
if (sll > 0) {tpp = toPips(MathAbs(SymbolAsk(Symbol) - sll), Symbol)*TakeProfitPercentSL/100;}
}
double lots = 0;
double pre_sll = sll;
if (pre_sll == 0) {
pre_sll = SymbolAsk(Symbol);
}
double pre_sl_pips = toPips(SymbolAsk(Symbol)-(pre_sll-toDigits(slp,Symbol)), Symbol);
if (VolumeMode == "fixed") {lots = DynamicLots(Symbol, VolumeMode, VolumeSize);}
else if (VolumeMode == "block-equity") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "block-balance") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "block-freemargin") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "equity") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "balance") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "freemargin") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "equityRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "balanceRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "freemarginRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "fixedRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeSizeRisk, pre_sl_pips);}
else if (VolumeMode == "fixedRatio") {lots = DynamicLots(Symbol, VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
else if (VolumeMode == "dynamic") {lots = _dVolumeSize_();}
else if (VolumeMode == "1326") {lots = Bet1326(Group, Symbol, mmTradesPool, mm1326InitialLots, mm1326Reverse);}
else if (VolumeMode == "fibonacci") {lots = BetFibonacci(Group, Symbol, mmTradesPool, mmFiboInitialLots);}
else if (VolumeMode == "dalembert") {lots = BetDalembert(Group, Symbol, mmTradesPool, mmDalembertInitialLots, mmDalembertReverse);}
else if (VolumeMode == "labouchere") {lots = BetLabouchere(Group, Symbol, mmTradesPool, mmLabouchereInitialLots, mmLabouchereList, mmLabouchereReverse);}
else if (VolumeMode == "martingale") {lots = BetMartingale(Group, Symbol, mmTradesPool, mmMgInitialLots, mmMgMultiplyOnLoss, mmMgMultiplyOnProfit, mmMgAddLotsOnLoss, mmMgAddLotsOnProfit, mmMgResetOnLoss, mmMgResetOnProfit);}
else if (VolumeMode == "sequence") {lots = BetSequence(Group, Symbol, mmTradesPool, mmSeqBaseLots, mmSeqOnLoss, mmSeqOnProfit, mmSeqReverse);}
lots = AlignLots(Symbol, lots, 0, VolumeUpperLimit);
datetime exp = ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_dExp_());
long ticket = BuyNow(Symbol, lots, sll, tpl, slp, tpp, Slippage, (MagicStart+(int)Group), MyComment, ArrowColorBuy, exp);
if (ticket > 0) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename _T9_,typename T10,typename T11,typename T12,typename T13,typename T14,typename T15,typename T16,typename T17,typename T18,typename T19,typename T20,typename T21,typename T22,typename T23,typename T24,typename T25,typename T26,typename T27,typename T28,typename T29,typename T30,typename T31,typename T32,typename T33,typename T34,typename T35,typename T36,typename T37,typename _T37_,typename T38,typename _T38_,typename T39,typename _T39_,typename T40,typename T41,typename T42,typename T43,typename T44,typename _T44_,typename T45,typename _T45_,typename T46,typename _T46_,typename T47,typename T48,typename T49,typename T50,typename T51,typename _T51_,typename T52,typename T53,typename T54>
class MDL_SellNow: public BlockCalls
{
public: /* Input Parameters */
T1 Group;
T2 Symbol;
T3 VolumeMode;
T4 VolumeSize;
T5 VolumeSizeRisk;
T6 VolumeRisk;
T7 VolumePercent;
T8 VolumeBlockPercent;
T9 dVolumeSize; virtual _T9_ _dVolumeSize_(){return(_T9_)0;}
T10 FixedRatioUnitSize;
T11 FixedRatioDelta;
T12 mmTradesPool;
T13 mmMgInitialLots;
T14 mmMgMultiplyOnLoss;
T15 mmMgMultiplyOnProfit;
T16 mmMgAddLotsOnLoss;
T17 mmMgAddLotsOnProfit;
T18 mmMgResetOnLoss;
T19 mmMgResetOnProfit;
T20 mm1326InitialLots;
T21 mm1326Reverse;
T22 mmFiboInitialLots;
T23 mmDalembertInitialLots;
T24 mmDalembertReverse;
T25 mmLabouchereInitialLots;
T26 mmLabouchereList;
T27 mmLabouchereReverse;
T28 mmSeqBaseLots;
T29 mmSeqOnLoss;
T30 mmSeqOnProfit;
T31 mmSeqReverse;
T32 VolumeUpperLimit;
T33 StopLossMode;
T34 StopLossPips;
T35 StopLossPercentPrice;
T36 StopLossPercentTP;
T37 dlStopLoss; virtual _T37_ _dlStopLoss_(){return(_T37_)0;}
T38 dpStopLoss; virtual _T38_ _dpStopLoss_(){return(_T38_)0;}
T39 ddStopLoss; virtual _T39_ _ddStopLoss_(){return(_T39_)0;}
T40 TakeProfitMode;
T41 TakeProfitPips;
T42 TakeProfitPercentPrice;
T43 TakeProfitPercentSL;
T44 dlTakeProfit; virtual _T44_ _dlTakeProfit_(){return(_T44_)0;}
T45 dpTakeProfit; virtual _T45_ _dpTakeProfit_(){return(_T45_)0;}
T46 ddTakeProfit; virtual _T46_ _ddTakeProfit_(){return(_T46_)0;}
T47 ExpMode;
T48 ExpDays;
T49 ExpHours;
T50 ExpMinutes;
T51 dExp; virtual _T51_ _dExp_(){return(_T51_)0;}
T52 Slippage;
T53 MyComment;
T54 ArrowColorSell;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_SellNow()
{
Group = (string)"";
Symbol = (string)CurrentSymbol();
VolumeMode = (string)"fixed";
VolumeSize = (double)0.1;
VolumeSizeRisk = (double)50.0;
VolumeRisk = (double)2.5;
VolumePercent = (double)100.0;
VolumeBlockPercent = (double)3.0;
FixedRatioUnitSize = (double)0.01;
FixedRatioDelta = (double)20.0;
mmTradesPool = (int)0;
mmMgInitialLots = (double)0.1;
mmMgMultiplyOnLoss = (double)2.0;
mmMgMultiplyOnProfit = (double)1.0;
mmMgAddLotsOnLoss = (double)0.0;
mmMgAddLotsOnProfit = (double)0.0;
mmMgResetOnLoss = (int)0;
mmMgResetOnProfit = (int)1;
mm1326InitialLots = (double)0.1;
mm1326Reverse = (bool)false;
mmFiboInitialLots = (double)0.1;
mmDalembertInitialLots = (double)0.1;
mmDalembertReverse = (bool)false;
mmLabouchereInitialLots = (double)0.1;
mmLabouchereList = (string)"1,2,3,4,5,6";
mmLabouchereReverse = (bool)false;
mmSeqBaseLots = (double)0.1;
mmSeqOnLoss = (string)"3,2,6";
mmSeqOnProfit = (string)"1";
mmSeqReverse = (bool)false;
VolumeUpperLimit = (double)0.0;
StopLossMode = (string)"fixed";
StopLossPips = (double)50.0;
StopLossPercentPrice = (double)0.55;
StopLossPercentTP = (double)100.0;
TakeProfitMode = (string)"fixed";
TakeProfitPips = (double)50.0;
TakeProfitPercentPrice = (double)0.55;
TakeProfitPercentSL = (double)100.0;
ExpMode = (string)"GTC";
ExpDays = (int)0;
ExpHours = (int)1;
ExpMinutes = (int)0;
Slippage = (ulong)4;
MyComment = (string)"";
ArrowColorSell = (color)clrRed;
}
public: /* The main method */
virtual void _execute_()
{
double sll = 0, slp = 0, tpl = 0, tpp = 0;
if (StopLossMode == "fixed") {slp = StopLossPips;}
else if (StopLossMode == "dynamicPips") {slp = _dpStopLoss_();}
else if (StopLossMode == "dynamicDigits") {slp = toPips(_ddStopLoss_(),Symbol);}
else if (StopLossMode == "dynamicLevel") {sll = _dlStopLoss_();}
else if (StopLossMode == "percentPrice") {sll = SymbolBid(Symbol) + (SymbolBid(Symbol) * StopLossPercentPrice / 100);}
if (TakeProfitMode == "fixed") {tpp = TakeProfitPips;}
else if (TakeProfitMode == "dynamicPips") {tpp = _dpTakeProfit_();}
else if (TakeProfitMode == "dynamicDigits") {tpp = toPips(_ddTakeProfit_(),Symbol);}
else if (TakeProfitMode == "dynamicLevel") {tpl = _dlTakeProfit_();}
else if (TakeProfitMode == "percentPrice") {tpl = SymbolBid(Symbol) - (SymbolBid(Symbol) * TakeProfitPercentPrice / 100);}
if (StopLossMode == "percentTP") {
if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
if (tpl > 0) {slp = toPips(MathAbs(SymbolBid(Symbol) - tpl), Symbol)*StopLossPercentTP/100;}
}
if (TakeProfitMode == "percentSL") {
if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
if (sll > 0) {tpp = toPips(MathAbs(SymbolBid(Symbol) - sll), Symbol)*TakeProfitPercentSL/100;}
}
double lots = 0;
double pre_sll = sll;
if (pre_sll == 0) {
pre_sll = SymbolBid(Symbol);
}
double pre_sl_pips = toPips((pre_sll+toDigits(slp,Symbol))-SymbolBid(Symbol), Symbol);
if (VolumeMode == "fixed") {lots = DynamicLots(Symbol, VolumeMode, VolumeSize);}
else if (VolumeMode == "block-equity") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "block-balance") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "block-freemargin") {lots = DynamicLots(Symbol, VolumeMode, VolumeBlockPercent);}
else if (VolumeMode == "equity") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "balance") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "freemargin") {lots = DynamicLots(Symbol, VolumeMode, VolumePercent);}
else if (VolumeMode == "equityRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "balanceRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "freemarginRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeRisk, pre_sl_pips);}
else if (VolumeMode == "fixedRisk") {lots = DynamicLots(Symbol, VolumeMode, VolumeSizeRisk, pre_sl_pips);}
else if (VolumeMode == "fixedRatio") {lots = DynamicLots(Symbol, VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
else if (VolumeMode == "dynamic") {lots = _dVolumeSize_();}
else if (VolumeMode == "1326") {lots = Bet1326(Group, Symbol, mmTradesPool, mm1326InitialLots, mm1326Reverse);}
else if (VolumeMode == "fibonacci") {lots = BetFibonacci(Group, Symbol, mmTradesPool, mmFiboInitialLots);}
else if (VolumeMode == "dalembert") {lots = BetDalembert(Group, Symbol, mmTradesPool, mmDalembertInitialLots, mmDalembertReverse);}
else if (VolumeMode == "labouchere") {lots = BetLabouchere(Group, Symbol, mmTradesPool, mmLabouchereInitialLots, mmLabouchereList, mmLabouchereReverse);}
else if (VolumeMode == "martingale") {lots = BetMartingale(Group, Symbol, mmTradesPool, mmMgInitialLots, mmMgMultiplyOnLoss, mmMgMultiplyOnProfit, mmMgAddLotsOnLoss, mmMgAddLotsOnProfit, mmMgResetOnLoss, mmMgResetOnProfit);}
else if (VolumeMode == "sequence") {lots = BetSequence(Group, Symbol, mmTradesPool, mmSeqBaseLots, mmSeqOnLoss, mmSeqOnProfit, mmSeqReverse);}
lots = AlignLots(Symbol, lots, 0, VolumeUpperLimit);
datetime exp = ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_dExp_());
long ticket = SellNow(Symbol, lots, sll, tpl, slp, tpp, Slippage, (MagicStart+(int)Group), MyComment, ArrowColorSell, exp);
if (ticket > 0) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5>
class MDL_IfOpenedOrders: public BlockCalls
{
public: /* Input Parameters */
T1 GroupMode;
T2 Group;
T3 SymbolMode;
T4 Symbol;
T5 BuysOrSells;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_IfOpenedOrders()
{
GroupMode = (string)"group";
Group = (string)"";
SymbolMode = (string)"symbol";
Symbol = (string)CurrentSymbol();
BuysOrSells = (string)"both";
}
public: /* The main method */
virtual void _execute_()
{
bool exist = false;
for (int index = TradesTotal()-1; index >= 0; index--)
{
if (TradeSelectByIndex(index, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
exist = true;
break;
}
}
if (exist == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename _T1_,typename T2,typename T3,typename _T3_,typename T4>
class MDL_Condition: public BlockCalls
{
public: /* Input Parameters */
T1 Lo; virtual _T1_ _Lo_(){return(_T1_)0;}
T2 compare;
T3 Ro; virtual _T3_ _Ro_(){return(_T3_)0;}
T4 crosswidth;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_Condition()
{
compare = (string)">";
crosswidth = (int)1;
}
public: /* The main method */
virtual void _execute_()
{
bool output1 = false, output2 = false; // output 1 and output 2
int crossover = 0;
if (compare == "x>" || compare == "x<") {crossover = 1;}
for (int i = 0; i <= crossover; i++)
{
FXD_MORE_SHIFT = i * crosswidth;
_T1_ lo = _Lo_();
if (MathAbs(lo) == EMPTY_VALUE) {return;}
FXD_MORE_SHIFT = i * crosswidth;
_T3_ ro = _Ro_();
if (MathAbs(ro) == EMPTY_VALUE) {return;}
if (CompareValues(compare, lo, ro))
{
if (i == 0)
{
output1 = true;
}
}
else
{
if (i == 0)
{
output2 = true;
}
else
{
output2 = false;
}
}
if (crossover == 1)
{
if (CompareValues(compare, ro, lo))
{
if (i == 0)
{
output2 = true;
}
}
else
{
if (i == 1)
{
output1 = false;
}
}
}
}
FXD_MORE_SHIFT = 0; // reset
if (output1 == true) {_callback_(1);}
else if (output2 == true) {_callback_(0);}
}
};
template<typename T1>
class MDL_OncePerMinutes: public BlockCalls
{
public: /* Input Parameters */
T1 MinutesPeriod;
/* Static Parameters */
datetime timenext;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_OncePerMinutes()
{
MinutesPeriod = (int)20;
/* Static Parameters (initial value) */
timenext = 0;
}
public: /* The main method */
virtual void _execute_()
{
datetime now = TimeCurrent();
if (now >= timenext)
{
while (true)
{
if (now >= timenext)
{
if (timenext == 0)
{
timenext = (datetime)(MathFloor(now / 86400.0) * 86400.0); // This calculation gives us 00:00 of today
}
timenext = timenext + (MinutesPeriod * 60);
}
else
{
break;
}
}
_callback_(1);
}
else
{
_callback_(0);
}
}
};
template<typename T1,typename T2>
class MDL_PlaySound: public BlockCalls
{
public: /* Input Parameters */
T1 MTsound;
T2 MYsound;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_PlaySound()
{
MTsound = (string)"ok";
MYsound = (string)"myfile.wav";
}
public: /* The main method */
virtual void _execute_()
{
string filename = MTsound;
if (MTsound == "custom") {filename = MYsound;}
else if (StringSubstr(filename, StringLen(filename)-4) != ".wav") {filename += ".wav";}
bool success = PlaySound(filename);
if (!success) {
Print("Play Sound Error: " + ErrorMessage());
}
_callback_(1);
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5>
class MDL_OnceAday: public BlockCalls
{
public: /* Input Parameters */
T1 ServerOrLocalTime;
T2 HoursFilter;
T3 CertainHour;
T4 StartHour;
T5 EndHour;
/* Static Parameters */
int day0;
int year0;
datetime skipUntil;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_OnceAday()
{
ServerOrLocalTime = (string)"server";
HoursFilter = (string)"disabled";
CertainHour = (string)"09:15";
StartHour = (string)"01:00";
EndHour = (string)"08:00";
/* Static Parameters (initial value) */
day0 = 0;
year0 = 0;
skipUntil = 0;
}
public: /* The main method */
virtual void _execute_()
{
int day = 0;
int year = 0;
bool next = false;
datetime time = 0;
int mode_time = 0;
if (ServerOrLocalTime == "server") {time = TimeCurrent(); mode_time = 0;}
else if (ServerOrLocalTime == "local") {time = TimeLocal(); mode_time = 1;}
else if (ServerOrLocalTime == "gmt") {time = TimeGMT(); mode_time = 2;}
if (time >= skipUntil)
{
MqlDateTime time_struct;
TimeToStruct(time, time_struct);
year = time_struct.year;
day = time_struct.day_of_year;
if (day != day0 || year != year0)
{
if (HoursFilter == "disabled")
{
next = true;
}
else if (HoursFilter == "hour")
{
if (
time >= TimeFromString(mode_time, CertainHour)
&& time < TimeFromString(mode_time, CertainHour) + 60 // make it 60 seconds period
)
{
next = true;
}
}
else if (HoursFilter == "period")
{
if (
time >= TimeFromString(mode_time, StartHour)
&& time < TimeFromString(mode_time, EndHour)
)
{
next = true;
}
}
}
}
if (next == true)
{
day0 = day;
year0 = year;
skipUntil = (datetime)(MathFloor((time + 86400) / 86400.0) * 86400.0); // This calculation gives us 00:00 of the following day
_callback_(1);
}
else
{
_callback_(0);
}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7>
class MDL_SignalBullsInArow: public BlockCalls
{
public: /* Input Parameters */
T1 SignalType;
T2 RowSize;
T3 MinBodySize;
T4 RowMode;
T5 Symbol;
T6 Period;
T7 Shift;
/* Static Parameters */
datetime bartime;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_SignalBullsInArow()
{
SignalType = (string)"continuous";
RowSize = (int)3;
MinBodySize = (double)5.0;
RowMode = (string)"normal";
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
Shift = (int)0;
/* Static Parameters (initial value) */
bartime = 0;
}
public: /* The main method */
virtual void _execute_()
{
bool success = true;
double cSizePrev = 0;
bool pass = false;
if (SignalType == "continuous" || bartime < iTime(Symbol,Period,1))
{
for (int id=Shift+RowSize-1; id>=Shift; id--)
{
double cSize = iClose(Symbol,Period,id) - iOpen(Symbol,Period,id);
if (
(cSize < toDigits(MinBodySize, Symbol))
|| (RowMode == "bigger" && cSizePrev > 0 && cSize <= cSizePrev)
|| (RowMode == "smaller" && cSizePrev > 0 && cSize >= cSizePrev)
)
{
success = false;
break;
}
cSizePrev = cSize;
}
if (success == true)
{
if (SignalType != "continuous")
{
bartime = iTime(Symbol,Period,1);
}
pass = true;
}
}
if (pass == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7>
class MDL_SignalBearsInArow: public BlockCalls
{
public: /* Input Parameters */
T1 SignalType;
T2 RowSize;
T3 MinBodySize;
T4 RowMode;
T5 Symbol;
T6 Period;
T7 Shift;
/* Static Parameters */
datetime bartime;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_SignalBearsInArow()
{
SignalType = (string)"continuous";
RowSize = (int)3;
MinBodySize = (double)5.0;
RowMode = (string)"normal";
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
Shift = (int)0;
/* Static Parameters (initial value) */
bartime = 0;
}
public: /* The main method */
virtual void _execute_()
{
bool success = true;
double cSizePrev = 0;
bool pass = false;
if (SignalType == "continuous" || bartime < iTime(Symbol,Period,1))
{
for (int id=Shift+RowSize-1; id>=Shift; id--)
{
double cSize = iOpen(Symbol,Period,id) - iClose(Symbol,Period,id);
if (
(cSize < toDigits(MinBodySize, Symbol))
|| (RowMode == "bigger" && cSizePrev > 0 && cSize <= cSizePrev)
|| (RowMode == "smaller" && cSizePrev > 0 && cSize >= cSizePrev)
)
{
success = false;
break;
}
cSizePrev = cSize;
}
if (success == true)
{
if (SignalType != "continuous")
{
bartime = iTime(Symbol,Period,1);
}
pass = true;
}
}
if (pass == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8>
class MDL_ChartScreenShot: public BlockCalls
{
public: /* Input Parameters */
T1 FilenameFolderName;
T2 FilenamePrefix;
T3 ChartMode;
T4 ChartScale;
T5 ChartIndent;
T6 ChartShift;
T7 ImageWidth;
T8 ImageHeight;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_ChartScreenShot()
{
FilenameFolderName = (string)"";
FilenamePrefix = (string)"";
ChartMode = (ENUM_CHART_MODE)CHART_BARS;
ChartScale = (int)-1;
ChartIndent = (bool)false;
ChartShift = (int)0;
ImageWidth = (int)0;
ImageHeight = (int)0;
}
public: /* The main method */
virtual void _execute_()
{
long chart_id = ChartID();
int sub_window = 0;
int subwindows = 0;
int w = 0;
int h = 0;
string filename = "";
string program_name = "";
bool success = false;
int first_bar = (int)ChartGetInteger(chart_id, CHART_FIRST_VISIBLE_BAR, sub_window);
int visible_bars = (int)ChartGetInteger(chart_id, CHART_VISIBLE_BARS, sub_window);
int original_navigate_bar = (visible_bars - first_bar - 2);
int original_chart_mode = (int)ChartGetInteger(chart_id, CHART_MODE, sub_window);
int original_chart_scale = (int)ChartGetInteger(chart_id, CHART_SCALE, sub_window);
bool original_shart_indent = (bool)ChartGetInteger(chart_id, CHART_SHIFT, sub_window);
w = (ImageWidth > 0) ? ImageWidth : (int)ChartGetInteger(chart_id, CHART_WIDTH_IN_PIXELS, sub_window);
if (ImageHeight <= 0)
{
subwindows = (int)ChartGetInteger(chart_id, CHART_WINDOWS_TOTAL);
for (int i = 0; i < subwindows; i++)
{
h += (int)ChartGetInteger(chart_id, CHART_HEIGHT_IN_PIXELS, i);
}
h += (subwindows-1) * 3;
}
else {
h = (int)ChartGetInteger(chart_id, CHART_HEIGHT_IN_PIXELS, sub_window);
}
ChartSetInteger(chart_id, CHART_MODE, sub_window, ChartMode);
if (ChartScale > 0) ChartSetInteger(chart_id, CHART_SCALE, sub_window, ChartScale);
ChartSetInteger(chart_id, CHART_SHIFT, sub_window, ChartIndent);
ChartNavigate(chart_id, CHART_END, -1 * MathAbs(ChartShift));
MqlDateTime time;
TimeToStruct(TimeCurrent(), time);
filename =
((FilenameFolderName != "") ? FilenameFolderName + "/" : "Screenshots of " + MQLInfoString(MQL_PROGRAM_NAME) + "/")
+ ((FilenamePrefix != "") ? FilenamePrefix + " " : "")
+ ChartSymbol(chart_id) + " "
+ StringFormat("%4d-%02d-%02d %02d.%02d.%02d", time.year, time.mon, time.day, time.hour, time.min, time.sec);
success = ChartScreenShot(chart_id, filename + ".gif", w, h);
ChartSetInteger(chart_id, CHART_MODE, sub_window, original_chart_mode);
ChartSetInteger(chart_id, CHART_SCALE, sub_window, original_chart_scale);
ChartSetInteger(chart_id, CHART_SHIFT, sub_window, original_shart_indent);
ChartNavigate(chart_id, CHART_END, original_navigate_bar);
ChartRedraw();
if (success) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename T10,typename T11,typename T12,typename T13,typename T14,typename T15,typename T16,typename _T16_,typename T17,typename T18,typename _T18_,typename T19,typename T20,typename _T20_,typename T21,typename T22,typename _T22_,typename T23,typename T24,typename _T24_,typename T25,typename T26,typename _T26_,typename T27,typename T28,typename _T28_,typename T29,typename T30,typename _T30_>
class MDL_CommentEx: public BlockCalls
{
public: /* Input Parameters */
T1 Title;
T2 ObjChartSubWindow;
T3 ObjCorner;
T4 ObjX;
T5 ObjY;
T6 ObjTitleFont;
T7 ObjTitleFontColor;
T8 ObjTitleFontSize;
T9 ObjLabelsFont;
T10 ObjLabelsFontColor;
T11 ObjLabelsFontSize;
T12 ObjFont;
T13 ObjFontColor;
T14 ObjFontSize;
T15 Label1;
T16 Value1; virtual _T16_ _Value1_(){return(_T16_)0;}
T17 Label2;
T18 Value2; virtual _T18_ _Value2_(){return(_T18_)0;}
T19 Label3;
T20 Value3; virtual _T20_ _Value3_(){return(_T20_)0;}
T21 Label4;
T22 Value4; virtual _T22_ _Value4_(){return(_T22_)0;}
T23 Label5;
T24 Value5; virtual _T24_ _Value5_(){return(_T24_)0;}
T25 Label6;
T26 Value6; virtual _T26_ _Value6_(){return(_T26_)0;}
T27 Label7;
T28 Value7; virtual _T28_ _Value7_(){return(_T28_)0;}
T29 Label8;
T30 Value8; virtual _T30_ _Value8_(){return(_T30_)0;}
/* Static Parameters */
bool initialized;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_CommentEx()
{
Title = (string)"Comment Message";
ObjChartSubWindow = (string)"";
ObjCorner = (int)CORNER_LEFT_UPPER;
ObjX = (int)5;
ObjY = (int)24;
ObjTitleFont = (string)"Georgia";
ObjTitleFontColor = (color)clrGold;
ObjTitleFontSize = (int)13;
ObjLabelsFont = (string)"Verdana";
ObjLabelsFontColor = (color)clrDarkGray;
ObjLabelsFontSize = (int)10;
ObjFont = (string)"Verdana";
ObjFontColor = (color)clrWhite;
ObjFontSize = (int)10;
Label1 = (string)"";
Label2 = (string)"";
Label3 = (string)"";
Label4 = (string)"";
Label5 = (string)"";
Label6 = (string)"";
Label7 = (string)"";
Label8 = (string)"";
/* Static Parameters (initial value) */
initialized = false;
}
public: /* The main method */
virtual void _execute_()
{
if (!MQLInfoInteger(MQL_TESTER) || MQLInfoInteger(MQL_VISUAL_MODE))
{
long ObjChartID = 0;
int ObjAnchor = ANCHOR_LEFT;
if (ObjCorner == CORNER_RIGHT_UPPER || ObjCorner == CORNER_RIGHT_LOWER)
{
ObjAnchor = ANCHOR_RIGHT;
}
string namebase = "fxd_cmnt_" + __block_user_number;
int subwindow = WindowFindVisible(ObjChartID, ObjChartSubWindow);
if (subwindow >= 0)
{
if ((string)Title != "")
{
string nametitle = namebase;
if(ObjectFind(ObjChartID, nametitle) < 0)
{
if (!ObjectCreate(ObjChartID, nametitle, OBJ_LABEL, subwindow, 0, 0, 0, 0))
{
Print(__FUNCTION__, ": failed to create text object! Error code = ", GetLastError());
}
else
{
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_FONTSIZE, (int)(ObjTitleFontSize));
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_COLOR, ObjTitleFontColor);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_BACK, 0);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_SELECTABLE, 1);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_SELECTED, 0);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_HIDDEN, 1);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_CORNER, ObjCorner);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_ANCHOR, ObjAnchor);
ObjectSetString(ObjChartID, nametitle, OBJPROP_FONT, ObjTitleFont);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_XDISTANCE, ObjX);
ObjectSetInteger(ObjChartID, nametitle, OBJPROP_YDISTANCE, ObjY);
}
}
else
{
ObjX = (int)ObjectGetInteger(ObjChartID, nametitle, OBJPROP_XDISTANCE);
ObjY = (int)ObjectGetInteger(ObjChartID, nametitle, OBJPROP_YDISTANCE);
}
ObjectSetString(ObjChartID, nametitle, OBJPROP_TEXT, (string)Title);
ObjY = (int)(ObjY + ObjTitleFontSize / 3);
}
for (int i = 1; i <= 8; i++)
{
string text = "";
string textlbl = "";
switch(i)
{
case 1: if (Label1 != "") {textlbl = Label1; text = (string)(_Value1_());} break;
case 2: if (Label2 != "") {textlbl = Label2; text = (string)(_Value2_());} break;
case 3: if (Label3 != "") {textlbl = Label3; text = (string)(_Value3_());} break;
case 4: if (Label4 != "") {textlbl = Label4; text = (string)(_Value4_());} break;
case 5: if (Label5 != "") {textlbl = Label5; text = (string)(_Value5_());} break;
case 6: if (Label6 != "") {textlbl = Label6; text = (string)(_Value6_());} break;
case 7: if (Label7 != "") {textlbl = Label7; text = (string)(_Value7_());} break;
case 8: if (Label8 != "") {textlbl = Label8; text = (string)(_Value8_());} break;
}
string name = namebase + "_" + (string)i;
string namelbl = name + "_l";
if (textlbl == "")
{
if (!initialized)
{
ObjectDelete(ObjChartID, namelbl);
ObjectDelete(ObjChartID, name);
}
continue;
}
if(ObjectFind(ObjChartID, name) < 0)
{
if (textlbl == "")
{
continue;
}
if (ObjectCreate(ObjChartID, namelbl, OBJ_LABEL, subwindow, 0, 0, 0, 0))
{
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_CORNER, ObjCorner);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_ANCHOR, ObjAnchor);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_BACK, 0);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_SELECTABLE, 0);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_SELECTED, 0);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_HIDDEN, 1);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_FONTSIZE, ObjLabelsFontSize);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_COLOR, ObjLabelsFontColor);
ObjectSetString(ObjChartID, namelbl, OBJPROP_FONT, ObjLabelsFont);
}
else
{
Print(__FUNCTION__, ": failed to create text object! Error code = ", GetLastError());
}
if (ObjectCreate(ObjChartID, name, OBJ_LABEL, subwindow, 0, 0, 0, 0))
{
ObjectSetInteger(ObjChartID, name, OBJPROP_CORNER, ObjCorner);
ObjectSetInteger(ObjChartID, name, OBJPROP_ANCHOR, ObjAnchor);
ObjectSetInteger(ObjChartID, name, OBJPROP_BACK, 0);
ObjectSetInteger(ObjChartID, name, OBJPROP_SELECTABLE, 0);
ObjectSetInteger(ObjChartID, name, OBJPROP_SELECTED, 0);
ObjectSetInteger(ObjChartID, name, OBJPROP_HIDDEN, 1);
ObjectSetInteger(ObjChartID, name, OBJPROP_FONTSIZE, ObjFontSize);
ObjectSetInteger(ObjChartID, name, OBJPROP_COLOR, ObjFontColor);
ObjectSetString(ObjChartID, name, OBJPROP_FONT, ObjFont);
}
else
{
Print(__FUNCTION__, ": failed to create text object! Error code = ", GetLastError());
}
}
else
{
if (textlbl == "")
{
ObjectDelete(ObjChartID, namelbl);
ObjectDelete(ObjChartID, name);
continue;
}
}
ObjY = (int)(ObjY + ObjFontSize + ObjFontSize/2);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_XDISTANCE, ObjX);
ObjectSetInteger(ObjChartID, namelbl, OBJPROP_YDISTANCE, ObjY);
ObjectSetString(ObjChartID, namelbl, OBJPROP_TEXT, (string)textlbl);
int x = 0;
int xsizelbl = (int)ObjectGetInteger(ObjChartID, namelbl, OBJPROP_XSIZE);
if (xsizelbl == 0) {
xsizelbl = (int)(StringLen((string)textlbl) * ObjFontSize / 1.5 + ObjFontSize / 2);
}
x = ObjX + (xsizelbl + ObjFontSize/2);
ObjectSetInteger(ObjChartID, name, OBJPROP_XDISTANCE, x);
ObjectSetInteger(ObjChartID, name, OBJPROP_YDISTANCE, ObjY);
ObjectSetString(ObjChartID, name, OBJPROP_TEXT, (string)text);
}
ChartRedraw();
}
initialized = true;
}
_callback_(1);
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5>
class MDL_IfOrders: public BlockCalls
{
public: /* Input Parameters */
T1 GroupMode;
T2 Group;
T3 SymbolMode;
T4 Symbol;
T5 BuysOrSells;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_IfOrders()
{
GroupMode = (string)"group";
Group = (string)"";
SymbolMode = (string)"symbol";
Symbol = (string)CurrentSymbol();
BuysOrSells = (string)"both";
}
public: /* The main method */
virtual void _execute_()
{
bool exist = false;
for (int index = TradesTotal()-1; index >= 0; index--)
{
if (TradeSelectByIndex(index, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
exist = true;
break;
}
}
if (exist == false)
{
for (int index = OrdersTotal()-1; index >= 0; index--)
{
if (PendingOrderSelectByIndex(index, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
exist = true;
break;
}
}
}
if (exist == true) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1,typename T2,typename T3,typename T4,typename T5,typename T6,typename T7,typename T8,typename T9,typename T10>
class MDL_LoopStartHistoryTrades: public BlockCalls
{
public: /* Input Parameters */
T1 GroupMode;
T2 Group;
T3 SymbolMode;
T4 Symbol;
T5 BuysOrSells;
T6 LoopDirection;
T7 LoopSkip;
T8 LoopEvery;
T9 LoopLimit;
T10 PassEnd;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_LoopStartHistoryTrades()
{
GroupMode = (string)"group";
Group = (string)"";
SymbolMode = (string)"symbol";
Symbol = (string)CurrentSymbol();
BuysOrSells = (string)"both";
LoopDirection = (string)"newest-to-oldest";
LoopSkip = (int)0;
LoopEvery = (int)0;
LoopLimit = (int)10;
PassEnd = (int)0;
}
public: /* The main method */
virtual void _execute_()
{
int saved_type = attrTypeInLoop();
ulong saved_ticket = attrTicketInLoop(); // This ticket number will be reloaded at the end of this loop, so if we are in another overlapping loop - it will continue using it's last used ticket number
int total = HistoryTradesTotal();
int count = 0;
int skip = -1;
int every = 0;
int i_start = 0, i_stop = 0, i_inc = 0, i = 0;
if (LoopDirection == "newest-to-oldest")
{
i_start = total-1;
i_stop = 0;
i_inc = -1;
}
else if (LoopDirection == "oldest-to-newest")
{
i_start = 0;
i_stop = total-1;
i_inc = 1;
}
i = i_start - i_inc;
while (true)
{
if (i == i_stop) break;
i = i + i_inc;
if (FXD_CONTINUE == true)
{
FXD_BREAK = false;
FXD_CONTINUE = false;
}
else if (FXD_BREAK == true)
{
FXD_BREAK = false;
FXD_CONTINUE = false;
break;
}
if (HistoryTradeSelectByIndex(i, GroupMode, Group, SymbolMode, Symbol, BuysOrSells))
{
skip++;
if (LoopSkip <= skip && (count < LoopLimit || LoopLimit == 0))
{
if (LoopEvery > 0)
{
every++;
if (every < LoopEvery) {continue;} else {every = 0;}
}
count++;
attrTypeInLoop(3);
attrTicketInLoop(OrderTicket());
_callback_(1);
if (count == LoopLimit) break;
}
}
}
attrTypeInLoop(saved_type);
attrTicketInLoop(saved_ticket); // Reloading Ticket number from the overlapping loop (if any)
FXD_BREAK = false;
FXD_CONTINUE = false;
if (
(PassEnd == 0)
|| (PassEnd == 1 && count > 0)
|| (PassEnd == 2 && count == 0)
) {
_callback_(0);
}
}
};
template<typename T1>
class MDL_LoopCheckHowItWasClosed: public BlockCalls
{
public: /* Input Parameters */
T1 ModeClosed;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_LoopCheckHowItWasClosed()
{
ModeClosed = (int)1;
}
public: /* The main method */
virtual void _execute_()
{
bool next = false;
if (OrderType() < 2)
{
string close_type = "nosltp";
double price_close = OrderClosePrice();
if (MathAbs(price_close - attrStopLoss()) == 0) {close_type = "sl";}
else if (MathAbs(price_close - attrTakeProfit()) == 0) {close_type = "tp";}
if (
(ModeClosed == 0)
|| (ModeClosed == 1 && (close_type == "sl" || close_type == "tp"))
|| (ModeClosed == 2 && close_type == "sl")
|| (ModeClosed == 3 && close_type == "tp")
|| (ModeClosed == 4 && close_type == "sltp")
) {
next = true;
}
}
else
{
return;
}
if (next == true) {_callback_(1);} else {_callback_(0);}
}
};
class MDL_IfTesting: public BlockCalls
{
virtual void _callback_(int r) {return;}
public: /* The main method */
virtual void _execute_()
{
if (MQLInfoInteger(MQL_TESTER)) {_callback_(1);} else {_callback_(0);}
}
};
template<typename T1>
class MDL_Terminate: public BlockCalls
{
public: /* Input Parameters */
T1 Message;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDL_Terminate()
{
Message = (string)"Program Terminated Itself";
}
public: /* The main method */
virtual void _execute_()
{
if (Message != "")
{
MessageBox(Message, "Self-Terminate", MB_OK);
}
ExpertRemove();
ChartRedraw(); // to remove the smile face
}
};
class MDLIC_value_value
{
public: /* Input Parameters */
double Value;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_value_value()
{
Value = (double)1.0;
}
public: /* The main method */
double _execute_()
{
return Value;
}
};
class MDLIC_value_time
{
public: /* Input Parameters */
int ModeTime;
int TimeSource;
string TimeStamp;
int TimeCandleID;
string TimeMarket;
ENUM_TIMEFRAMES TimeCandleTimeframe;
int TimeComponentYear;
int TimeComponentMonth;
double TimeComponentDay;
double TimeComponentHour;
double TimeComponentMinute;
int TimeComponentSecond;
int ModeTimeShift;
int TimeShiftYears;
int TimeShiftMonths;
int TimeShiftWeeks;
double TimeShiftDays;
double TimeShiftHours;
double TimeShiftMinutes;
int TimeShiftSeconds;
bool TimeSkipWeekdays;
/* Static Parameters */
datetime retval;
datetime retval0;
int ModeTime0;
int smodeshift;
int years0;
int months0;
datetime Time[];
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_value_time()
{
ModeTime = (int)0;
TimeSource = (int)0;
TimeStamp = (string)"00:00";
TimeCandleID = (int)1;
TimeMarket = (string)"";
TimeCandleTimeframe = (ENUM_TIMEFRAMES)0;
TimeComponentYear = (int)0;
TimeComponentMonth = (int)0;
TimeComponentDay = (double)0.0;
TimeComponentHour = (double)12.0;
TimeComponentMinute = (double)0.0;
TimeComponentSecond = (int)0;
ModeTimeShift = (int)0;
TimeShiftYears = (int)0;
TimeShiftMonths = (int)0;
TimeShiftWeeks = (int)0;
TimeShiftDays = (double)0.0;
TimeShiftHours = (double)0.0;
TimeShiftMinutes = (double)0.0;
TimeShiftSeconds = (int)0;
TimeSkipWeekdays = (bool)false;
/* Static Parameters (initial value) */
retval = 0;
retval0 = 0;
ModeTime0 = 0;
smodeshift = 0;
years0 = 0;
months0 = 0;
}
public: /* The main method */
datetime _execute_()
{
if (TimeMarket == "") TimeMarket = Symbol();
if (ModeTime == 0)
{
if (TimeSource == 0) {retval = TimeCurrent();}
else if (TimeSource == 1) {retval = TimeLocal();}
else if (TimeSource == 2) {retval = TimeGMT();}
}
else if (ModeTime == 1)
{
retval = StringToTime(TimeStamp);
retval0 = retval;
}
else if (ModeTime==2)
{
retval = TimeFromComponents(TimeSource, TimeComponentYear, TimeComponentMonth, TimeComponentDay, TimeComponentHour, TimeComponentMinute, TimeComponentSecond);
}
else if (ModeTime == 3)
{
ArraySetAsSeries(Time,true);
CopyTime(TimeMarket,TimeCandleTimeframe,TimeCandleID,1,Time);
retval = Time[0];
}
if (ModeTimeShift > 0)
{
int sh = 1;
if (ModeTimeShift == 1) {sh = -1;}
if (
ModeTimeShift != smodeshift
|| TimeShiftYears != years0
|| TimeShiftMonths != months0
)
{
years0 = TimeShiftYears;
months0 = TimeShiftMonths;
if (TimeShiftYears > 0 || TimeShiftMonths > 0)
{
int year = 0, month = 0, week = 0, day = 0, hour = 0, minute = 0, second = 0;
if (ModeTime == 3)
{
year = TimeComponentYear;
month = TimeComponentYear;
day = (int)MathFloor(TimeComponentDay);
hour = (int)(MathFloor(TimeComponentHour) + (24 * (TimeComponentDay - MathFloor(TimeComponentDay))));
minute = (int)(MathFloor(TimeComponentMinute) + (60 * (TimeComponentHour - MathFloor(TimeComponentHour))));
second = (int)(TimeComponentSecond + (60 * (TimeComponentMinute - MathFloor(TimeComponentMinute))));
}
else {
year = TimeYear(retval);
month = TimeMonth(retval);
day = TimeDay(retval);
hour = TimeHour(retval);
minute = TimeMinute(retval);
second = TimeSeconds(retval);
}
year = year + TimeShiftYears * sh;
month = month + TimeShiftMonths * sh;
if (month < 0) {month = 12 - month;}
else if (month > 12) {month = month - 12;}
retval = StringToTime(IntegerToString(year)+"."+IntegerToString(month)+"."+IntegerToString(day)+" "+IntegerToString(hour)+":"+IntegerToString(minute)+":"+IntegerToString(second));
}
}
retval = retval + (sh * ((604800 * TimeShiftWeeks) + SecondsFromComponents(TimeShiftDays, TimeShiftHours, TimeShiftMinutes, TimeShiftSeconds)));
if (TimeSkipWeekdays == true)
{
int weekday = TimeDayOfWeek(retval);
if (sh > 0) { // forward
if (weekday == 0) {retval = retval + 86400;}
else if (weekday == 6) {retval = retval + 172800;}
}
else if (sh < 0) { // back
if (weekday == 0) {retval = retval - 172800;}
else if (weekday == 6) {retval = retval - 86400;}
}
}
}
smodeshift = ModeTimeShift;
ModeTime0 = ModeTime;
return (datetime)retval;
}
};
class MDLIC_indicators_iMA
{
public: /* Input Parameters */
int MAperiod;
int MAshift;
ENUM_MA_METHOD MAmethod;
ENUM_APPLIED_PRICE AppliedPrice;
string Symbol;
ENUM_TIMEFRAMES Period;
int Shift;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_indicators_iMA()
{
MAperiod = (int)14;
MAshift = (int)0;
MAmethod = (ENUM_MA_METHOD)MODE_SMA;
AppliedPrice = (ENUM_APPLIED_PRICE)PRICE_CLOSE;
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
Shift = (int)0;
}
public: /* The main method */
double _execute_()
{
return iMA(Symbol, Period, MAperiod, MAshift, MAmethod, AppliedPrice, Shift + FXD_MORE_SHIFT);
}
};
class MDLIC_account_AccountBalance
{
public: /* Input Parameters */
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_account_AccountBalance()
{
}
public: /* The main method */
double _execute_()
{
return NormalizeDouble(AccountInfoDouble(ACCOUNT_BALANCE), 2);
}
};
class MDLIC_text_text
{
public: /* Input Parameters */
string Text;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_text_text()
{
Text = (string)"sample text";
}
public: /* The main method */
string _execute_()
{
return Text;
}
};
class MDLIC_statistics_InitialDeposit
{
public: /* Input Parameters */
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_statistics_InitialDeposit()
{
}
public: /* The main method */
double _execute_()
{
return(InitialDeposit());
}
};
class MDLIC_account_AccountProfit
{
public: /* Input Parameters */
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_account_AccountProfit()
{
}
public: /* The main method */
double _execute_()
{
return NormalizeDouble(AccountInfoDouble(ACCOUNT_PROFIT), 2);
}
};
class MDLIC_statistics_TradesCount
{
public: /* Input Parameters */
string Mode;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_statistics_TradesCount()
{
Mode = (string)"total";
}
public: /* The main method */
double _execute_()
{
return(TradesCount(Mode));
}
};
class MDLIC_statistics_ConsecutiveLossesCount
{
public: /* Input Parameters */
string Mode;
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_statistics_ConsecutiveLossesCount()
{
Mode = (string)"total";
}
public: /* The main method */
double _execute_()
{
return(ConsecutiveLossesCount(Mode));
}
};
class MDLIC_account_AccountNumber
{
public: /* Input Parameters */
virtual void _callback_(int r) {return;}
public: /* Constructor */
MDLIC_account_AccountNumber()
{
}
public: /* The main method */
long _execute_()
{
return (long)AccountInfoInteger(ACCOUNT_LOGIN);
}
};
class Block0: public MDL_ChartSetProperties<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>
{
public: /* Constructor */
Block0() {
__block_number = 0;
__block_user_number = "12";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {1};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
ChartOnForeground = 1;
ChartAutoScroll = 1;
ChartShowOHLC = 0;
ChartShowBidLine = 1;
ChartShowAskLine = 1;
ChartShowLastLine = 0;
ChartShowPeriodSeparators = 0;
ChartShowGrid = 0;
ChartShowDescriptions = 1;
ChartShowTradeLevels = 1;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[1].run(0);
}
}
virtual void _beforeExecute_()
{
ChartMode = (int)CHART_CANDLES;
ChartShowVolumes = (int)CHART_VOLUME_HIDE;
}
};
class Block1: public MDL_ChartSetColors<color,color,color,color,color,color,color,color,color,color,color,color,color>
{
public: /* Constructor */
Block1() {
__block_number = 1;
__block_user_number = "13";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {3};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[3].run(1);
}
}
virtual void _beforeExecute_()
{
ChartColorBackground = (color)clrBlack;
ChartColorForeground = (color)clrDodgerBlue;
ChartColorGrid = (color)clrBlack;
ChartColorBarUp = (color)clrDarkOliveGreen;
ChartColorBarDown = (color)clrOrangeRed;
ChartColorBullCandle = (color)clrNavy;
ChartColorBearCandle = (color)clrRed;
ChartColorDojiCandle = (color)clrLime;
ChartColorVolumes = (color)clrLimeGreen;
ChartColorBid = (color)clrLightSlateGray;
ChartColorAsk = (color)clrRed;
ChartColorLast = (color)clrLimeGreen;
ChartColorStopLevels = (color)clrRed;
}
};
class Block2: public MDL_NoOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block2() {
__block_number = 2;
__block_user_number = "14";
_beforeExecuteEnabled = true;
int ___outbound_blocks[2] = {4,5};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[4].run(2);
_blocks_[5].run(2);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block3: public MDL_CheckTradesCount<string,int,string,string,string,string,string>
{
public: /* Constructor */
Block3() {
__block_number = 3;
__block_user_number = "26";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {2};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Compare = "<=";
CompareCount = 1;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[2].run(3);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block4: public MDL_NewTopInTrend<string,int,double,double,string,ENUM_TIMEFRAMES>
{
public: /* Constructor */
Block4() {
__block_number = 4;
__block_user_number = "27";
_beforeExecuteEnabled = true;
int ___outbound_blocks[2] = {6,8};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[6].run(4);
_blocks_[8].run(4);
}
}
virtual void _beforeExecute_()
{
PastCandlesCount = (int)_externs::inp27_PastCandlesCount;
PastPipsMinimum = (double)_externs::inp27_PastPipsMinimum;
TrendQuality = (double)_externs::inp27_TrendQuality;
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block5: public MDL_NewBottomInTrend<string,int,double,double,string,ENUM_TIMEFRAMES>
{
public: /* Constructor */
Block5() {
__block_number = 5;
__block_user_number = "28";
_beforeExecuteEnabled = true;
int ___outbound_blocks[2] = {10,7};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[7].run(5);
_blocks_[10].run(5);
}
}
virtual void _beforeExecute_()
{
PastCandlesCount = (int)_externs::inp28_PastCandlesCount;
PastPipsMinimum = (double)_externs::inp28_PastPipsMinimum;
TrendQuality = (double)_externs::inp28_TrendQuality;
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block6: public MDL_BuyNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block6() {
__block_number = 6;
__block_user_number = "29";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {30};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
StopLossPercentPrice = 0.75;
TakeProfitPercentPrice = 0.4;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[30].run(6);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp29_VolumeSize;
StopLossPips = (double)_externs::inp29_StopLossPips;
TakeProfitPips = (double)_externs::inp29_TakeProfitPips;
ArrowColorBuy = (color)clrBlue;
}
};
class Block7: public MDL_SellNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block7() {
__block_number = 7;
__block_user_number = "35";
_beforeExecuteEnabled = true;
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp35_VolumeSize;
StopLossPips = (double)_externs::inp35_StopLossPips;
TakeProfitPips = (double)_externs::inp35_TakeProfitPips;
ArrowColorSell = (color)clrRed;
}
};
class Block8: public MDL_IfOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block8() {
__block_number = 8;
__block_user_number = "36";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {9};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "buys";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[9].run(8);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block9: public MDL_SellNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block9() {
__block_number = 9;
__block_user_number = "38";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {32};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[32].run(9);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp38_VolumeSize;
StopLossPips = (double)_externs::inp38_StopLossPips;
TakeProfitPips = (double)_externs::inp38_TakeProfitPips;
ArrowColorSell = (color)clrRed;
}
};
class Block10: public MDL_IfOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block10() {
__block_number = 10;
__block_user_number = "39";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {11};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "sells";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[11].run(10);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block11: public MDL_BuyNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block11() {
__block_number = 11;
__block_user_number = "40";
_beforeExecuteEnabled = true;
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp40_VolumeSize;
StopLossPips = (double)_externs::inp40_StopLossPips;
TakeProfitPips = (double)_externs::inp40_TakeProfitPips;
ArrowColorBuy = (color)clrBlue;
}
};
class Block12: public MDL_Condition<MDLIC_indicators_iMA,double,string,MDLIC_indicators_iMA,double,int>
{
public: /* Constructor */
Block12() {
__block_number = 12;
__block_user_number = "74";
int ___outbound_blocks[1] = {13};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.MAperiod = 150;
}
public: /* Custom methods */
virtual double _Lo_() {
Lo.MAmethod = MODE_EMA;
Lo.AppliedPrice = PRICE_CLOSE;
Lo.Symbol = CurrentSymbol();
Lo.Period = CurrentTimeframe();
return Lo._execute_();
}
virtual double _Ro_() {
Ro.MAmethod = MODE_EMA;
Ro.AppliedPrice = PRICE_CLOSE;
Ro.Symbol = CurrentSymbol();
Ro.Period = CurrentTimeframe();
return Ro._execute_();
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[13].run(12);
}
}
};
class Block13: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block13() {
__block_number = 13;
__block_user_number = "75";
int ___outbound_blocks[1] = {14};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 70;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[14].run(13);
}
}
};
class Block14: public MDL_PlaySound<string,string>
{
public: /* Constructor */
Block14() {
__block_number = 14;
__block_user_number = "76";
MTsound = "custom";
MYsound = "Uptrend.wav";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
};
class Block15: public MDL_NoOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block15() {
__block_number = 15;
__block_user_number = "77";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {12};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[12].run(15);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block16: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block16() {
__block_number = 16;
__block_user_number = "79";
int ___outbound_blocks[1] = {17};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 70;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[17].run(16);
}
}
};
class Block17: public MDL_PlaySound<string,string>
{
public: /* Constructor */
Block17() {
__block_number = 17;
__block_user_number = "80";
MTsound = "custom";
MYsound = "Downtrend.wav";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
};
class Block18: public MDL_Condition<MDLIC_indicators_iMA,double,string,MDLIC_indicators_iMA,double,int>
{
public: /* Constructor */
Block18() {
__block_number = 18;
__block_user_number = "81";
int ___outbound_blocks[1] = {16};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.MAperiod = 150;
compare = "<";
}
public: /* Custom methods */
virtual double _Lo_() {
Lo.MAmethod = MODE_EMA;
Lo.AppliedPrice = PRICE_CLOSE;
Lo.Symbol = CurrentSymbol();
Lo.Period = CurrentTimeframe();
return Lo._execute_();
}
virtual double _Ro_() {
Ro.MAmethod = MODE_EMA;
Ro.AppliedPrice = PRICE_CLOSE;
Ro.Symbol = CurrentSymbol();
Ro.Period = CurrentTimeframe();
return Ro._execute_();
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[16].run(18);
}
}
};
class Block19: public MDL_NoOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block19() {
__block_number = 19;
__block_user_number = "82";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {18};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[18].run(19);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block20: public MDL_NoOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block20() {
__block_number = 20;
__block_user_number = "97";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {21};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[21].run(20);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block21: public MDL_OnceAday<string,string,string,string,string>
{
public: /* Constructor */
Block21() {
__block_number = 21;
__block_user_number = "98";
int ___outbound_blocks[1] = {22};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[22].run(21);
}
}
};
class Block22: public MDL_PlaySound<string,string>
{
public: /* Constructor */
Block22() {
__block_number = 22;
__block_user_number = "99";
MTsound = "custom";
MYsound = "Intro.wav";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
};
class Block23: public MDL_Condition<MDLIC_account_AccountBalance,double,string,MDLIC_value_value,double,int>
{
public: /* Constructor */
Block23() {
__block_number = 23;
__block_user_number = "100";
int ___outbound_blocks[1] = {15};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.Value = 99.0;
}
public: /* Custom methods */
virtual double _Lo_() {return Lo._execute_();}
virtual double _Ro_() {return Ro._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[15].run(23);
}
}
};
class Block24: public MDL_Condition<MDLIC_account_AccountBalance,double,string,MDLIC_value_value,double,int>
{
public: /* Constructor */
Block24() {
__block_number = 24;
__block_user_number = "101";
int ___outbound_blocks[1] = {19};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.Value = 99.0;
}
public: /* Custom methods */
virtual double _Lo_() {return Lo._execute_();}
virtual double _Ro_() {return Ro._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[19].run(24);
}
}
};
class Block25: public MDL_SignalBullsInArow<string,int,double,string,string,ENUM_TIMEFRAMES,int>
{
public: /* Constructor */
Block25() {
__block_number = 25;
__block_user_number = "104";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {24};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinBodySize = 2.0;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[24].run(25);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block26: public MDL_SignalBearsInArow<string,int,double,string,string,ENUM_TIMEFRAMES,int>
{
public: /* Constructor */
Block26() {
__block_number = 26;
__block_user_number = "105";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {24};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinBodySize = 2.0;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[24].run(26);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block27: public MDL_SignalBullsInArow<string,int,double,string,string,ENUM_TIMEFRAMES,int>
{
public: /* Constructor */
Block27() {
__block_number = 27;
__block_user_number = "106";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {23};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinBodySize = 2.0;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[23].run(27);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block28: public MDL_SignalBearsInArow<string,int,double,string,string,ENUM_TIMEFRAMES,int>
{
public: /* Constructor */
Block28() {
__block_number = 28;
__block_user_number = "107";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {23};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinBodySize = 2.0;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[23].run(28);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
}
};
class Block29: public MDL_ChartScreenShot<string,string,ENUM_CHART_MODE,int,bool,int,int,int>
{
public: /* Constructor */
Block29() {
__block_number = 29;
__block_user_number = "108";
_beforeExecuteEnabled = true;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
ChartMode = (ENUM_CHART_MODE)CHART_BARS;
}
};
class Block30: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block30() {
__block_number = 30;
__block_user_number = "109";
int ___outbound_blocks[1] = {29};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 5;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[29].run(30);
}
}
};
class Block31: public MDL_ChartScreenShot<string,string,ENUM_CHART_MODE,int,bool,int,int,int>
{
public: /* Constructor */
Block31() {
__block_number = 31;
__block_user_number = "110";
_beforeExecuteEnabled = true;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
ChartMode = (ENUM_CHART_MODE)CHART_BARS;
}
};
class Block32: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block32() {
__block_number = 32;
__block_user_number = "111";
int ___outbound_blocks[1] = {31};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 5;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[31].run(32);
}
}
};
class Block33: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block33() {
__block_number = 33;
__block_user_number = "112";
_beforeExecuteEnabled = true;
Value1.Text = "";
Value2.Text = "";
Value3.Text = "";
Value4.Text = "";
Value5.Text = "";
Value6.Text = "";
Value7.Text = "";
Value8.Text = "";
Title = "Created By ClassicForexTrader";
ObjX = 18;
ObjY = 62;
ObjTitleFont = "Yu Gothic";
ObjTitleFontSize = 20;
}
public: /* Custom methods */
virtual string _Value1_() {return Value1._execute_();}
virtual string _Value2_() {return Value2._execute_();}
virtual string _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual string _Value5_() {return Value5._execute_();}
virtual string _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 62;
ObjCorner = (int)CORNER_RIGHT_UPPER;
ObjTitleFontColor = (color)clrBlue;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block34: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block34() {
__block_number = 34;
__block_user_number = "113";
_beforeExecuteEnabled = true;
Value1.Text = "";
Value2.Text = "";
Value3.Text = "";
Value4.Text = "";
Value5.Text = "";
Value6.Text = "";
Value7.Text = "";
Value8.Text = "";
Title = "WhatsApp +27680536880";
ObjX = 18;
ObjY = 125;
ObjTitleFont = "Yu Gothic";
ObjTitleFontSize = 14;
}
public: /* Custom methods */
virtual string _Value1_() {return Value1._execute_();}
virtual string _Value2_() {return Value2._execute_();}
virtual string _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual string _Value5_() {return Value5._execute_();}
virtual string _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 125;
ObjCorner = (int)_externs::inp113_ObjCorner;
ObjTitleFontColor = (color)clrSteelBlue;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block35: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block35() {
__block_number = 35;
__block_user_number = "117";
_beforeExecuteEnabled = true;
Value1.Text = "";
Value2.Text = "";
Value3.Text = "";
Value4.Text = "";
Value5.Text = "";
Value6.Text = "";
Value7.Text = "";
Value8.Text = "";
Title = "Behind The Charts Forex Trading Robot";
ObjX = 711;
ObjY = 26;
}
public: /* Custom methods */
virtual string _Value1_() {return Value1._execute_();}
virtual string _Value2_() {return Value2._execute_();}
virtual string _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual string _Value5_() {return Value5._execute_();}
virtual string _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 26;
ObjCorner = (int)CORNER_RIGHT_UPPER;
ObjTitleFontColor = (color)clrDarkGreen;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block36: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block36() {
__block_number = 36;
__block_user_number = "155";
_beforeExecuteEnabled = true;
Value1.Text = "";
Value2.Text = "";
Value3.Text = "";
Value4.Text = "";
Value5.Text = "";
Value6.Text = "";
Value7.Text = "";
Value8.Text = "";
Title = "Hey the Robot is running";
ObjX = 18;
ObjY = 174;
}
public: /* Custom methods */
virtual string _Value1_() {return Value1._execute_();}
virtual string _Value2_() {return Value2._execute_();}
virtual string _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual string _Value5_() {return Value5._execute_();}
virtual string _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 174;
ObjCorner = (int)CORNER_RIGHT_UPPER;
ObjTitleFontColor = (color)clrSteelBlue;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block37: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block37() {
__block_number = 37;
__block_user_number = "269";
_beforeExecuteEnabled = true;
Value1.Text = "";
Value2.Text = "";
Value3.Text = "";
Value4.Text = "";
Value5.Text = "";
Value6.Text = "";
Value7.Text = "";
Value8.Text = "";
Title = "Let's Make Money";
ObjX = 20;
ObjY = 219;
ObjTitleFont = "Yu Gothic";
}
public: /* Custom methods */
virtual string _Value1_() {return Value1._execute_();}
virtual string _Value2_() {return Value2._execute_();}
virtual string _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual string _Value5_() {return Value5._execute_();}
virtual string _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 219;
ObjCorner = (int)CORNER_RIGHT_UPPER;
ObjTitleFontColor = (color)clrSteelBlue;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block38: public MDL_NoOpenedOrders<string,string,string,string,string>
{
public: /* Constructor */
Block38() {
__block_number = 38;
__block_user_number = "270";
_beforeExecuteEnabled = true;
int ___outbound_blocks[6] = {33,34,35,36,37,47};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 0) {
_blocks_[33].run(38);
_blocks_[34].run(38);
_blocks_[35].run(38);
_blocks_[36].run(38);
_blocks_[37].run(38);
_blocks_[47].run(38);
}
else if (value == 1) {
_blocks_[33].run(38);
_blocks_[34].run(38);
_blocks_[35].run(38);
_blocks_[36].run(38);
_blocks_[37].run(38);
_blocks_[47].run(38);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block39: public MDL_Condition<MDLIC_indicators_iMA,double,string,MDLIC_indicators_iMA,double,int>
{
public: /* Constructor */
Block39() {
__block_number = 39;
__block_user_number = "271";
int ___outbound_blocks[1] = {40};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.MAperiod = 150;
}
public: /* Custom methods */
virtual double _Lo_() {
Lo.MAmethod = MODE_EMA;
Lo.AppliedPrice = PRICE_CLOSE;
Lo.Symbol = CurrentSymbol();
Lo.Period = CurrentTimeframe();
return Lo._execute_();
}
virtual double _Ro_() {
Ro.MAmethod = MODE_EMA;
Ro.AppliedPrice = PRICE_CLOSE;
Ro.Symbol = CurrentSymbol();
Ro.Period = CurrentTimeframe();
return Ro._execute_();
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[40].run(39);
}
}
};
class Block40: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block40() {
__block_number = 40;
__block_user_number = "272";
int ___outbound_blocks[1] = {41};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 70;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[41].run(40);
}
}
};
class Block41: public MDL_PlaySound<string,string>
{
public: /* Constructor */
Block41() {
__block_number = 41;
__block_user_number = "273";
MTsound = "custom";
MYsound = "BuyOpened.wav";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
};
class Block42: public MDL_IfOrders<string,string,string,string,string>
{
public: /* Constructor */
Block42() {
__block_number = 42;
__block_user_number = "274";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {43};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "buys";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[43].run(42);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block43: public MDL_Condition<MDLIC_indicators_iMA,double,string,MDLIC_indicators_iMA,double,int>
{
public: /* Constructor */
Block43() {
__block_number = 43;
__block_user_number = "277";
int ___outbound_blocks[1] = {44};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Ro.MAperiod = 150;
compare = "<";
}
public: /* Custom methods */
virtual double _Lo_() {
Lo.MAmethod = MODE_EMA;
Lo.AppliedPrice = PRICE_CLOSE;
Lo.Symbol = CurrentSymbol();
Lo.Period = CurrentTimeframe();
return Lo._execute_();
}
virtual double _Ro_() {
Ro.MAmethod = MODE_EMA;
Ro.AppliedPrice = PRICE_CLOSE;
Ro.Symbol = CurrentSymbol();
Ro.Period = CurrentTimeframe();
return Ro._execute_();
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[44].run(43);
}
}
};
class Block44: public MDL_OncePerMinutes<int>
{
public: /* Constructor */
Block44() {
__block_number = 44;
__block_user_number = "278";
int ___outbound_blocks[1] = {45};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
MinutesPeriod = 70;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[45].run(44);
}
}
};
class Block45: public MDL_PlaySound<string,string>
{
public: /* Constructor */
Block45() {
__block_number = 45;
__block_user_number = "279";
MTsound = "custom";
MYsound = "SellOpened.wav";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
};
class Block46: public MDL_IfOrders<string,string,string,string,string>
{
public: /* Constructor */
Block46() {
__block_number = 46;
__block_user_number = "280";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {39};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "buys";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[39].run(46);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block47: public MDL_CommentEx<string,string,int,int,int,string,color,int,string,color,int,string,color,int,string,MDLIC_statistics_InitialDeposit,double,string,MDLIC_account_AccountProfit,double,string,MDLIC_statistics_TradesCount,double,string,MDLIC_text_text,string,string,MDLIC_statistics_ConsecutiveLossesCount,double,string,MDLIC_account_AccountBalance,double,string,MDLIC_text_text,string,string,MDLIC_text_text,string>
{
public: /* Constructor */
Block47() {
__block_number = 47;
__block_user_number = "281";
_beforeExecuteEnabled = true;
Value3.Mode = "history";
Value4.Text = "= TotalTrades-No Loses";
Value5.Mode = "maximum";
Value7.Text = "";
Value8.Text = "";
Title = "Trade Perfomance";
ObjX = 750;
ObjY = 58;
Label1 = "Start Balance";
Label2 = "Running Profit";
Label3 = "TotalTrades";
Label4 = "No Wins";
Label5 = "No Loses";
Label6 = "Total Amount";
}
public: /* Custom methods */
virtual double _Value1_() {return Value1._execute_();}
virtual double _Value2_() {return Value2._execute_();}
virtual double _Value3_() {return Value3._execute_();}
virtual string _Value4_() {return Value4._execute_();}
virtual double _Value5_() {return Value5._execute_();}
virtual double _Value6_() {return Value6._execute_();}
virtual string _Value7_() {return Value7._execute_();}
virtual string _Value8_() {return Value8._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
/* Inputs, modified into the code must be set here every time */
ObjY = 58;
ObjCorner = (int)CORNER_LEFT_UPPER;
ObjTitleFontColor = (color)clrGold;
ObjLabelsFontColor = (color)clrDarkGray;
ObjFontColor = (color)clrWhite;
}
};
class Block48: public MDL_SellNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block48() {
__block_number = 48;
__block_user_number = "292";
_beforeExecuteEnabled = true;
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp292_VolumeSize;
StopLossPips = (double)_externs::inp292_StopLossPips;
TakeProfitPips = (double)_externs::inp292_TakeProfitPips;
ArrowColorSell = (color)clrRed;
}
};
class Block49: public MDL_LoopStartHistoryTrades<string,string,string,string,string,string,int,int,int,int>
{
public: /* Constructor */
Block49() {
__block_number = 49;
__block_user_number = "293";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {51};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "buys";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[51].run(49);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block50: public MDL_BuyNow<string,string,string,double,double,double,double,double,MDLIC_value_value,double,double,double,int,double,double,double,double,double,int,int,double,bool,double,double,bool,double,string,bool,double,string,string,bool,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,double,double,double,MDLIC_value_value,double,MDLIC_value_value,double,MDLIC_value_value,double,string,int,int,int,MDLIC_value_time,datetime,ulong,string,color>
{
public: /* Constructor */
Block50() {
__block_number = 50;
__block_user_number = "296";
_beforeExecuteEnabled = true;
dVolumeSize.Value = 0.1;
dpStopLoss.Value = 100.0;
ddStopLoss.Value = 0.01;
dpTakeProfit.Value = 100.0;
ddTakeProfit.Value = 0.01;
dExp.ModeTimeShift = 2;
dExp.TimeShiftDays = 1.0;
dExp.TimeSkipWeekdays = true;
}
public: /* Custom methods */
virtual double _dVolumeSize_() {return dVolumeSize._execute_();}
virtual double _dlStopLoss_() {return dlStopLoss._execute_();}
virtual double _dpStopLoss_() {return dpStopLoss._execute_();}
virtual double _ddStopLoss_() {return ddStopLoss._execute_();}
virtual double _dlTakeProfit_() {return dlTakeProfit._execute_();}
virtual double _dpTakeProfit_() {return dpTakeProfit._execute_();}
virtual double _ddTakeProfit_() {return ddTakeProfit._execute_();}
virtual datetime _dExp_() {return dExp._execute_();}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
VolumeSize = (double)_externs::inp296_VolumeSize;
StopLossPips = (double)_externs::inp296_StopLossPips;
TakeProfitPips = (double)_externs::inp296_TakeProfitPips;
ArrowColorBuy = (color)clrBlue;
}
};
class Block51: public MDL_LoopCheckHowItWasClosed<int>
{
public: /* Constructor */
Block51() {
__block_number = 51;
__block_user_number = "298";
int ___outbound_blocks[1] = {50};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
ModeClosed = 2;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[50].run(51);
}
}
};
class Block52: public MDL_LoopStartHistoryTrades<string,string,string,string,string,string,int,int,int,int>
{
public: /* Constructor */
Block52() {
__block_number = 52;
__block_user_number = "299";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {53};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
BuysOrSells = "sells";
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[53].run(52);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block53: public MDL_LoopCheckHowItWasClosed<int>
{
public: /* Constructor */
Block53() {
__block_number = 53;
__block_user_number = "304";
int ___outbound_blocks[1] = {48};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
ModeClosed = 2;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[48].run(53);
}
}
};
class Block54: public MDL_CheckTradesCount<string,int,string,string,string,string,string>
{
public: /* Constructor */
Block54() {
__block_number = 54;
__block_user_number = "305";
_beforeExecuteEnabled = true;
int ___outbound_blocks[2] = {49,52};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
Compare = "<=";
CompareCount = 10;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[49].run(54);
_blocks_[52].run(54);
}
}
virtual void _beforeExecute_()
{
Symbol = (string)CurrentSymbol();
}
};
class Block55: public MDL_ChartSetProperties<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>
{
public: /* Constructor */
Block55() {
__block_number = 55;
__block_user_number = "361";
_beforeExecuteEnabled = true;
int ___outbound_blocks[1] = {56};
ArrayCopy(__outbound_blocks, ___outbound_blocks);
ChartOnForeground = 1;
ChartAutoScroll = 1;
ChartShowOHLC = 0;
ChartShowBidLine = 1;
ChartShowAskLine = 1;
ChartShowLastLine = 0;
ChartShowPeriodSeparators = 0;
ChartShowGrid = 0;
ChartShowDescriptions = 1;
ChartShowTradeLevels = 1;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
if (value == 1) {
_blocks_[56].run(55);
}
}
virtual void _beforeExecute_()
{
ChartMode = (int)CHART_CANDLES;
ChartShowVolumes = (int)CHART_VOLUME_HIDE;
}
};
class Block56: public MDL_ChartSetColors<color,color,color,color,color,color,color,color,color,color,color,color,color>
{
public: /* Constructor */
Block56() {
__block_number = 56;
__block_user_number = "362";
_beforeExecuteEnabled = true;
}
public: /* Callback & Run */
virtual void _callback_(int value) {
}
virtual void _beforeExecute_()
{
ChartColorBackground = (color)clrBlack;
ChartColorForeground = (color)clrDodgerBlue;
ChartColorGrid = (color)clrBlack;
ChartColorBarUp = (color)clrDarkOliveGreen;
ChartColorBarDown = (color)clrOrangeRed;
ChartColorBullCandle = (color)clrNavy;
ChartColorBearCandle = (color)clrRed;
ChartColorDojiCandle = (color)clrLime;
ChartColorVolumes = (colorПоказано первые 50% кода (символов: 197704)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.