3 Tier London Breakout EA
Сообщите нам, если считаете, что материал размещён без разрешения.
Сообщить о материале
Обращение по товару «# new 3 tier london breakout ea v1.3c.mq4» отправится на рассмотрение. Укажите контакт для ответа и опишите причину.
О программе
Данный торговый советник работает на платформе MetaTrader 4 и реализует стратегию «3 Tier London Breakout». Советник анализирует ценовые данные за заданный сеанс установления цены (price establishment window), формирует уровни прорыва (box high/low) и открывает сделки BUY/SELL при пробое этих уровней. В качестве визуальной поддержки может отображать торговые коробки, уровни и линии Фибоначчи прямо на графике.
Советник поддерживает до пяти уровней тейк-профита и один уровень стоп-лосса, рассчитываемые на основе размера ценового короба. Встроена система управления рисками: ограничения по количеству сделок, убытков и прибыли за сеанс, контроль максимального спреда и проскальзывания. Также реализована функция перехода в безубыток (Move to BE) при достижении определённых условий.
Доступна функция мартингала — как автоматическая, так и по заданной последовательности множителей. Советник корректно обрабатывает работу с ECN-брокерами, повторные входы на заданном таймфрейме и отображение информационных данных о текущем состоянии торговли. Все торговые операции выполняются через стандартные средства MetaTrader 4.
Настройки программы
| Настройка | Описание |
|---|---|
| SendTrades | Переключатель фактической торговли. При значении false советник только отображает уровни и короба на графике, но не отправляет ордера. |
| Lot | Фиксированный размер лота для торговли, используется при MaxRisk = 0. |
| MaxRisk | Процент риска от свободного маржи для расчёта размера лота. При значении 0 используется фиксированный Lot. |
| MagicNumber | Магический номер для идентификации ордеров советника. При значении 0 создаётся уникальный автоматически. |
| SessionStart | Время начала окна установления цены в минутах от начала дня (например, 360 = 06:00). |
| SessionLength | Длительность окна установления цены в минутах. |
| SessionEnd | Время окончания ежедневного торгового сеанса в формате минут от начала дня (например, 120 = 02:00). |
| MinBoxSizeInPips | Минимальный размер короба в пунктах, при котором допускается торговля. При меньшем размере рекомендуется уменьшить лот. |
| MaxBoxSizeInPips | Максимальный допустимый размер короба в пунктах. При превышении торговля не производится. |
| LimitBoxToMaxSize | При значении true короб, превышающий MaxBoxSizeInPips, ограничивается до MaxBoxSizeInPips. |
| StickBoxToLatestExtreme | При значении true (и включённом LimitBoxToMaxSize) короб привязывается к последнему экстремуму (верх или низ). При false короб центрируется на EMA. |
| TP1Factor | Коэффициент расчёта первого тейк-профита от размера короба. Если значение больше или равно 10, интерпретируется как фиксированное количество пунктов. |
| TP3Factor | Коэффициент расчёта третьего тейк-профита от размера короба. Если значение больше или равно 10, интерпретируется как фиксированное количество пунктов. При значении 0 сделки 2 и 3 не открываются. |
| TP5Factor | Коэффициент расчёта пятого тейк-профита от размера короба. Если значение больше или равно 10, интерпретируется как фиксированное количество пунктов. При значении 0 сделки 4 и 5 не открываются. |
| TP2_help | Текстовый параметр с пояснением: TP2 устанавливается на полпути между TP1 и TP3. |
| TP4_help | Текстовый параметр с пояснением: TP4 устанавливается на полпути между TP3 и TP5. |
| SLFactor | Коэффициент расчёта стоп-лосса от размера короба. Если значение больше или равно 10, интерпретируется как фиксированное количество пунктов. |
| LevelsResizeFactor | Коэффициент масштабирования размера ценового короба при расчёте торговых уровней. |
| TFforReentry | Таймфрейм для повторного входа: последняя закрытая свеча на этом таймфрейме должна закрыться внутри короба для разрешения новых сделок. |
| TradeComment | Текстовый комментарий, добавляемый к каждой открытой сделке. |
| MaxTradesAllowedPerSession | Максимальное количество сделок за сеанс. При значении 0 ограничений нет. |
| MaxLossesAllowedPerSession | Максимальное количество убытков за сеанс. При достижении лимита новые сделки не открываются. |
| MaxWinsAllowedPerSession | Максимальное количество прибыльных сделок за сеанс. При значении 0 ограничений нет. |
| BreakEvenProfitInPips | Количество пунктов фиксации безубытка при срабатывании HalfClose. |
| MoveToBEFactor | Коэффициент для перевода стоп-лосса в безубыток. Если значение больше 10, интерпретируется как фиксированное количество пунктов. |
| _mart1 | Заголовок раздела настроек последовательности мартингала. |
| _mart2 | Заголовок раздела настроек последовательности мартингала. |
| martingale_sequence | Строка значений последовательности множителей мартингала через запятую. |
| AutoMartingale | Включает или отключает автоматический мартингал. При включении советник автоматически рассчитывает множитель лота для возмещения убытков. |
| ResetMartAtFirstProfit | При значении true последовательность мартингала сбрасывается при первой прибыльной сделке; при false — продолжается масштабирование до полного возмещения убытков. |
| Slippage | Допустимое проскальзывание в пунктах при отправке ордеров. |
| MaxSpread | Максимальный допустимый спред в пунктах. При превышении спреда советник не отправляет ордера. |
| brokerIsECN | Переключатель, указывающий, что брокер является ECN. При значении true ордера отправляются без SL и TP, затем модифицируются. |
| ShowBoxes | При значении true отображает торговые короба и уровни на графике, как соответствующий индикатор. |
| BoxColorOK | Цвет отображения допустимого короба, подходящего для торговли. |
| BoxColorNOK | Цвет отображения короба, не прошедшего проверку по размеру (слишком маленький или слишком большой). |
| BoxColorMAX | Цвет отображения короба, превышающего максимально допустимый размер. |
| LevelColor | Цвет линий уровней и подписей на графике. |
| SessionColor | Цвет фона, отображающий торговой сеанс на графике. |
| FibLength | Длина линий Фибоначчи, отображаемых на графике. |
| showProfitZone | При значении true отображается зона прибыли на графике. |
| ProfitColor | Цвет зоны прибыли на графике. |
| objPrefix | Префикс имён объектов индикатора London Breakout на графике. |
| Gap | Текстовый параметр, используемый для форматирования отображаемых комментариев на графике. |
| _other_marts | Заголовок раздела альтернативных последовательностей мартингала. |
| aggressive_fibonacci_sequence | Строка значений альтернативной агрессивной последовательности (каждый второй элемент последовательности Фибоначчи). |
| powers_of_2_sequence | Строка значений последовательности степеней двойки. |
| fibonacci_sequence | Строка значений стандартной последовательности Фибоначчи: F(n)=F(n-1)+F(n-2). |
| mild_fibonacci_sequence | Строка значений умеренной последовательности: F(n)=F(n-1)+F(n-3). |
| Debug | Включает дополнительные отладочные сообщения в журнале при значении true. |
Поиск по коду файла
/*+------------------------------------------------------------------+
*
* Version history:
*
* V1.3c: (modify by Franky)
* - time is in minutes format (due to testing window start / range in StrategyTester)
* - modified default vaues of StickBoxToLatestExtreme, TP3Factor, TP5Factor, MaxLossesAllowedPerSession
*
* V1.3b:
* - fixed the "zero divide" error: it was on 2/4-digits brokers only, due to typo in "pip" calculation :-((
* Thanks to sabooky for spotting this!
*
* V1.3a:
* - work-around the "zero divide" error that happens sometimes;
* However, this is NOT a fix, and it will only hide the error, and possibly change the EA's behaviour
* and prevent it trading that session.
* Refresh your charts and history data, that's all i can see so far...
*
* V1.3:
* - Option to trade 5 TP levels instead of 3:
* - added "TP5Factor"; when set to 0, Trades 4 & 5 are NOT used;
* - Added "MoveToBEFactor": move to BE when price has covered at least this ratio of TP1;
* - default is 1: move to BE when hit TP1;
* - example with 0.66: it will move to BE at 2/3 of TP1;
* - any value >1 will be taken as a fixed pip count instead of a factor of TP1;
* - when martingale is used: if trades are still open from the previous session,
* then open new trades with the PREVIOUS (lower) martingale multiplier instead of the same multiplier;
* - Added "MaxWinsAllowedPerSession" input;
* - Added "TFforReentry" input: 15(=M15) is the default, but can be changed to 1(M1) or 5(M5) to re-enter on shorter TF;
* - Added "Debug" input (more Print() when true)
* - fixed(hopefully!) "trade 2&3 not moving to BE when TP1 is hit";
*
* V1.2b:
* - fixed "StickBoxToLatestExtreme" option... box was always sticking to the highest price;
*
* V1.2a:
* - fixed "zero divide error" with Martingale code when limiting trades to only Trade 1 (when "TP3Factor" is set to 0);
*
* V1.2:
* - fixed ECN broker order sending (must send with both SL AND TP set to 0, then modify the order);
* - when "TP3Factor" is set to 0, Trades 2 & 3 will NOT be sent; only Trade 1 will be used.
* - Added "StickBoxToLatestExtreme" input (false);
* when true, the box will "stick" to the box high or low, whichever comes last;
* when false(default), the box will be centered on the EMA(box_time_range) value, as in previous versions;
* This extension is targeted at exploring and optimizing the box POSITION in PRICE, as suggested by JohnnyBSmart;
* - added "MaxSpread" input: trades will NOT be sent when the spread is higher than this value;
* - fixed session time calculation issues seen when running MT4 on Linux (thanks to xmph).
*
* V1.1: added ResetMartAtFirstProfit input;
*
* V1.0: original version by Squalou, posted on forexfactory.com
* (thread:
* - "3 Tier London Breakout.mq4" indicator can be used for visual help;
*
*+------------------------------------------------------------------+
*/
#property show_inputs
#include <WinUser32.mqh>
#include <stdlib.mqh>
#include <stderror.mqh>
#define EA_VERSION "V1.3c"
extern bool SendTrades = false;
extern double Lot = 0.01;
extern double MaxRisk = 0; // if 0 then use fixed Lots above
extern int MagicNumber=0; // if 0 then will autocreate a unique MagicNumber
extern int SessionStart = 360; // time for start of price establishment window
extern int SessionLength = 119; // time for end of price establishment window
extern int SessionEnd = 120; // end of daily session; tomorrow is another day!
extern int MinBoxSizeInPips = 15; // min tradable box size; when box is smaller than that, you should at least reduce your usual lot-size if you decide to trade it;
extern int MaxBoxSizeInPips = 80; // max tradable box size; don't trade when box is larger than that value
extern bool LimitBoxToMaxSize = true; // when true, a box larger than MaxBoxSizeInPips will be limited to MaxBoxSizeInPips.
extern bool StickBoxToLatestExtreme = true; // (applies when "LimitBoxToMaxSize" is true) when true, the box will "stick" to the box high or low, whichever comes last; else it will be centered on the EMA(box_time_range) value;
extern double TP1Factor = 1.000; // if >=10, this will be taken as FIXED PIPs rather than a factor of the box size;
double TP2Factor; // set to half-way between TP1Factor and TP3Factor;
extern double TP3Factor = 0.0; // if >=10, this will be taken as FIXED PIPs rather than a factor of the box size; if 0, Trades 2&3 will NOT be sent (only Trade 1);
double TP4Factor; // set to half-way between TP3Factor and TP5Factor;
extern double TP5Factor = 0.0;// TP4 and TP5 targets are OPTIONAL: set TP5Factor=0 to allow only up to TP3 target;
extern string TP2_help = "TP2 is half-way between TP1 and TP3";
extern string TP4_help = "TP4 is half-way between TP3 and TP5";
extern double SLFactor = 1.000; // if >=10, this will be taken as FIXED PIPs rather than a factor of the box size;
int NumTradesToOpen = 3; // number of trades to open: 3 when TP3Factor!=0, or only 1 when TP3Factor==0;
extern double LevelsResizeFactor = 1.0;
extern int TFforReentry = PERIOD_M15; // TF for re-entry: the last closed bar of this TF must close inside the box in order to allow opening new trades;
extern string TradeComment="3 Tier London Breakout";
extern int MaxTradesAllowedPerSession=0;
extern int MaxLossesAllowedPerSession=2;
extern int MaxWinsAllowedPerSession=0;
extern int BreakEvenProfitInPips=1; // lock-in this amount of pips when HalfClose is hit;
extern double MoveToBEFactor = 1.0; // move to BE+ when price has covered at least this ratio of TP1;
extern string _mart1="----MARTINGALE multipliers sequence:";
extern string _mart2="----not used when first multiplier is 0:";
extern string martingale_sequence="0,1,2,5,13,34,89,233,610,1597,4181";
extern bool AutoMartingale=false;
extern bool ResetMartAtFirstProfit=false; // when true, the Mart sequence is reset as soon as profitable trade is reached; else it will scale-in until recouped ALL losses;
extern int Slippage = 3; // pips
extern int MaxSpread = 4; // pips; EA won't send trades if spread is higher than this value;
extern bool brokerIsECN=false;
extern bool ShowBoxes = true; // when true, will show boxes and fibs just like the Indicator would do; this avoids using the indicator AND the EA together;
extern color BoxColorOK = LightBlue;
extern color BoxColorNOK = Red;
extern color BoxColorMAX = Orange;
extern color LevelColor = Black;
extern color SessionColor = Linen; // show Session periods with a different background color
extern int FibLength = 12;
extern bool showProfitZone = true;
extern color ProfitColor = LightGreen;
extern string objPrefix = "EA-LB2-"; // Prefixes of London Breakout Indicator objects;
extern string Gap=" ";
extern string _other_marts="---Other martingale sequences, in decreasing aggressivity(risk) order:";
extern string aggressive_fibonacci_sequence="1,2,5,13,34,89,233,610,1597,4181"; // =every second term of fibonacci sequence;
extern string powers_of_2_sequence="1,2,4,8,16,32,64,128,256,512,1024,2048,4096";
extern string fibonacci_sequence="1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597"; // F(n)=F(n-1)+F(n-2);
extern string mild_fibonacci_sequence="1,2,3,4,6,9,13,19,28,41,60,88,129,189,277,406"; // F(n)=F(n-1)+F(n-3);
extern bool Debug=false; // set to true to get additional debug Print() in the Journal logs;
#define NL "\n"
#define Status_initializing "????? I N I T I A L I Z I N G ?????"
#define Status_initialized "..... I N I T I A L I Z E D ....."
#define Status_trading "+++++ T R A D I N G +++++"
#define Status_not_trading "!!!!! N O T T R A D I N G (Box size) !!!!!"
#define Status_finished "----- F I N I S H E D F O R T O D A Y -----"
double BuyEntry,BuyTP1,BuyTP2,BuyTP3,BuyTP4,BuyTP5,BuySL;
double SellEntry,SellTP1,SellTP2,SellTP3,SellTP4,SellTP5,SellSL;
int SL_pips,TP1_pips,TP2_pips,TP3_pips,TP4_pips,TP5_pips,MoveToBE_pips;
double TP1FactorInput,TP2FactorInput,TP3FactorInput,TP4FactorInput,TP5FactorInput,SLFactorInput;
datetime tBoxStart,tBoxEnd,tSessionStart,tSessionEnd,tLastComputedSessionStart,tLastComputedSessionEnd;
double boxHigh,boxLow,boxExtent,boxMedianPrice;
int magic1,magic2,magic3,magic4,magic5;
string symbol;
string TradingStatus;
bool ClosedForFriday;
bool ClosedForSaturday;
double TradingStartHHMM,TradingEndHHMM;
bool TradeHour = false, prev_TradeHour=false;
int LastOrderProfitable=false;
bool UseMartingale=false;
double MartFactor[],LastLotMultiplier=0;
int MartDepth=0;
int Mart_Idx=0;
int TradesOpen, TradesOpenThisSession, TradesWon, TradesLost, TradesTotal;
string comment;
bool RobotDisabled;
string DisabledMessage;
int pipMult; // multiplier to convert pips to Points;
double pip,pipvalue;
int digits;
double minlot,lotstep;
int SLIPPAGE;
double previousAsk,currentAsk,previousBid,currentBid;
int maxSL;
string op_str[6] = { "BUY","SELL","BUYLIMIT","SELLLIMIT","BUYSTOP","SELLSTOP"};
void DisplayUserFeedback()
{
static bool alreadyPrinted=false;
if (IsTesting()&& !IsVisualMode() && alreadyPrinted) return; // saves cpu time when backtesting
comment = Gap+WindowExpertName()+ " "+ EA_VERSION+ NL;
if (MaxRisk <= 0) {
comment = comment+Gap+ "Lot size = "+ Lot+ " (MaxRisk not used)"+ NL;
} else {
comment = comment+Gap+ "MaxRisk = "+ MaxRisk+ "% => "+ DoubleToStr(Lot,2)+ "Lots, AccountFreeMargin = "+ DoubleToStr(AccountFreeMargin(),0)+ AccountCurrency()+ NL;
}
comment = comment+Gap+ "Magic number = "+ MagicNumber+ NL
+Gap+ "Trading Hours: "+ DoubleToStr(TradingStartHHMM/100,2)+ " - "+ DoubleToStr(TradingEndHHMM/100,2)+ NL
+Gap+ "Box=["+StartTime+"-"+EndTime+"] Session ends at "+SessionEndTime+", Box min "+DoubleToStr(MinBoxSizeInPips,0)+"p,"+" max "+DoubleToStr(MaxBoxSizeInPips,0)+"p,"+NL
+Gap+ "OPENING "+ NumTradesToOpen + " TRADES each time" +NL
+Gap+ "Buy at "+ DoubleToStr(BuyEntry, Digits)+NL
+Gap+ "Sell at "+ DoubleToStr(SellEntry, Digits)+ NL
+Gap+ " SL="+DoubleToStr(SL_pips,0)+"p"+",TP1="+DoubleToStr(TP1_pips,0)+"p";
if (TP2Factor>0) comment = comment+",TP2="+DoubleToStr(TP2_pips,0)+"p";
if (TP3Factor>0) comment = comment+",TP3="+DoubleToStr(TP3_pips,0)+"p";
if (TP4Factor>0) comment = comment+",TP4="+DoubleToStr(TP4_pips,0)+"p";
if (TP5Factor>0) comment = comment+",TP5="+DoubleToStr(TP5_pips,0)+"p";
comment = comment+NL+Gap+ "Moving to BE+"+BreakEvenProfitInPips+"p after "+MoveToBE_pips+"p"+ NL
+Gap+ "Local time: "+ TimeToStr(TimeLocal())+ " Broker time: "+ TimeToStr(TimeCurrent())+ " Current Bar time: "+ TimeToStr(Time[0])+ NL
;
/*
if (TrailingStopPips>0) {
comment = comment+Gap+ " Trailing stops at "+TrailingStopPips+" pips, by steps of "+TrailingStopStep+" pips"+ NL;
}
*/
if (UseMartingale) {
if (AutoMartingale) {
comment =comment+Gap+" AUTO-MARTINGALE ENABLED"+NL;
} else {
comment =comment+Gap+" MARTINGALE FACTORS: ";
for (int i=0;i<MartDepth;i++) {
if (i==Mart_Idx) comment=comment+" ->";
comment=comment+DoubleToStr(MartFactor[i],0);
if (i==Mart_Idx) comment=comment+"<- ";
comment=comment+",";
}
comment=comment+NL;
}
} else {
comment =comment+Gap+" Martingale NOT used"+NL;
}
comment = comment+Gap+ EA_VERSION+ " " + TradingStatus+ NL;
if (IsTesting() && !IsVisualMode()) {
Print(comment);
alreadyPrinted = true;
return;
}
Comment(comment);
}//void DisplayUserFeedback()
string StartTime, EndTime, SessionEndTime;
int init()
{
// код доступен только после оплаты
}
int deinit()
{
if (!IsTesting()) RemoveObjects(objPrefix);
Comment("");
return(0);
}
void OnTick()
{
// код доступен только после оплаты
}//End start()
void compute_LB_Indi_LEVELS(datetime now)
{
int boxStartShift,boxEndShift;
if (tBoxEnd <= now && now < tBoxEnd+86400) return; // box is less than 24h in the past: it is up-to-date
tBoxStart = StrToTime(TimeToStr(now,TIME_DATE) + " " + StartTime);
tBoxEnd = StrToTime(TimeToStr(now,TIME_DATE) + " " + EndTime);
if (tBoxStart > tBoxEnd) tBoxStart -= 86400; // midnight wrap fix
if (now < tBoxEnd) { // consider the last PAST box
tBoxStart -= 86400;
tBoxEnd -= 86400;
while ((TimeDayOfWeek(tBoxStart)==0 || TimeDayOfWeek(tBoxStart)==6)
&& (TimeDayOfWeek(tBoxEnd)==0 || TimeDayOfWeek(tBoxEnd)==6) ) {
tBoxStart -= 86400;
tBoxEnd -= 86400;
}
}
tSessionStart = tBoxEnd;
tSessionEnd = StrToTime(TimeToStr(tSessionStart,TIME_DATE) + " " + SessionEndTime);
if (tSessionStart > tSessionEnd) tSessionEnd = tSessionEnd + 86400; // midnight wrap fix
if (TimeDayOfWeek(tSessionEnd)==6/*saturday*/) tSessionEnd += 2*86400;
if (TimeDayOfWeek(tSessionEnd)==0/*sunday*/) tSessionEnd += 86400;
tLastComputedSessionStart = tSessionStart;
tLastComputedSessionEnd = tSessionEnd;
boxStartShift = iBarShift(NULL,0,tBoxStart);
boxEndShift = iBarShift(NULL,0,tBoxEnd);
boxHigh = High[iHighest(NULL,0,MODE_HIGH,(boxStartShift-boxEndShift+1),boxEndShift)];
boxLow = Low[iLowest(NULL,0,MODE_LOW,(boxStartShift-boxEndShift+1),boxEndShift)];
boxMedianPrice = (boxHigh+boxLow)/2;
boxExtent = boxHigh - boxLow;
if (boxExtent == 0) {
_Alert("boxExtent is ZERO: remove the EA, refresh your chart and history data, then reload EA.");
return; // no clue yet why this could ever be, but it happens sometimes!
}
if (boxExtent >= MaxBoxSizeInPips * pip && LimitBoxToMaxSize==true) { // box too large, but we allow to trade it at its max acceptable value
if (StickBoxToLatestExtreme==true) {
int boxStartShiftM1 = iBarShift(NULL,PERIOD_M1,tBoxStart);
int boxEndShiftM1 = iBarShift(NULL,PERIOD_M1,tBoxEnd);
int boxHighShift = iHighest(NULL,PERIOD_M1,MODE_HIGH,(boxStartShiftM1-boxEndShiftM1+1),boxEndShiftM1);
int boxLowShift = iLowest(NULL,PERIOD_M1,MODE_LOW,(boxStartShiftM1-boxEndShiftM1+1),boxEndShiftM1);
boxExtent = MaxBoxSizeInPips * pip;
if (boxHighShift <= boxLowShift) {
boxMedianPrice = boxHigh - boxExtent/2;
} else {
boxMedianPrice = boxLow + boxExtent/2;
}
} else {
boxExtent = MaxBoxSizeInPips * pip;
boxMedianPrice = iMA(NULL,0,boxStartShift-boxEndShift,0,MODE_EMA,PRICE_MEDIAN,boxEndShift);
}
}
boxExtent *= LevelsResizeFactor;
boxHigh = NormalizeDouble(boxMedianPrice + boxExtent/2,Digits);
boxLow = NormalizeDouble(boxMedianPrice - boxExtent/2,Digits);
TP1Factor = TP1FactorInput;
TP3Factor = TP3FactorInput;
TP5Factor = TP5FactorInput;
SLFactor = SLFactorInput;
BuyEntry = boxHigh;
SellEntry = boxLow;
if (TP1Factor < 10) TP1_pips = boxExtent*TP1Factor/pip;
else { TP1_pips = TP1Factor; TP1Factor = TP1_pips*pip/boxExtent; }
BuyTP1 = NormalizeDouble(BuyEntry + TP1_pips*pip,Digits);
SellTP1 = NormalizeDouble(SellEntry - TP1_pips*pip,Digits);
BuyTP2 = 0; SellTP2 = 0;
BuyTP3 = 0; SellTP3 = 0;
if (TP3Factor>0) { // Trades 2&3 enabled
if (TP3Factor < 10) TP3_pips = boxExtent*TP3Factor/pip;
else { TP3_pips = TP3Factor; TP3Factor = TP3_pips*pip/boxExtent; }
BuyTP3 = NormalizeDouble(BuyEntry + TP3_pips*pip,Digits);
SellTP3 = NormalizeDouble(SellEntry - TP3_pips*pip,Digits);
TP2Factor = (TP1Factor+TP3Factor)/2;
if (TP2Factor < 10) TP2_pips = boxExtent*TP2Factor/pip;
else { TP2_pips = TP2Factor; TP2Factor = TP2_pips*pip/boxExtent; }
BuyTP2 = NormalizeDouble(BuyEntry + TP2_pips*pip,Digits);
SellTP2 = NormalizeDouble(SellEntry - TP2_pips*pip,Digits);
}
BuyTP4 = 0; SellTP4 = 0;
BuyTP5 = 0; SellTP5 = 0;
if (TP5Factor>0) { // Trades 4&5 enabled
if (TP5Factor < 10) TP5_pips = boxExtent*TP5Factor/pip;
else { TP5_pips = TP5Factor; TP5Factor = TP5_pips*pip/boxExtent; }
BuyTP5 = NormalizeDouble(BuyEntry + TP5_pips*pip,Digits);
SellTP5 = NormalizeDouble(SellEntry - TP5_pips*pip,Digits);
TP4Factor = (TP3Factor+TP5Factor)/2;
if (TP4Factor < 10) TP4_pips = boxExtent*TP4Factor/pip;
else { TP4_pips = TP4Factor; TP4Factor = TP4_pips*pip/boxExtent; }
BuyTP4 = NormalizeDouble(BuyEntry + TP4_pips*pip,Digits);
SellTP4 = NormalizeDouble(SellEntry - TP4_pips*pip,Digits);
}
if (SLFactor < 10) SL_pips = boxExtent*SLFactor/pip;
else { SL_pips = SLFactor; SLFactor = SL_pips*pip/boxExtent; }
BuySL = NormalizeDouble(BuyEntry - SL_pips*pip,Digits);
SellSL = NormalizeDouble(SellEntry + SL_pips*pip,Digits);
if (MoveToBEFactor <= 1) MoveToBE_pips = MoveToBEFactor * TP1_pips;
else MoveToBE_pips = MoveToBEFactor;
}//compute_LB_Indi_LEVELS
void show_boxes(datetime now)
{
bool new_box = drawBoxOnce (objPrefix+"Session-"+TimeToStr(tSessionStart,TIME_DATE | TIME_SECONDS),tSessionStart,0,tSessionEnd,BuyEntry*2,SessionColor,1, STYLE_SOLID, true);
if (new_box == true) {
string boxName = objPrefix+"Box-"+TimeToStr(now,TIME_DATE)+"-"+StartTime+"-"+EndTime;
if (boxExtent >= MaxBoxSizeInPips * pip) { // box too large: DON'T TRADE !
if (LimitBoxToMaxSize==false) { // box too large, but we allow to trade it at its max acceptable value
drawBox (boxName,tBoxStart,boxLow,tBoxEnd,boxHigh,BoxColorNOK,1, STYLE_SOLID, true);
DrawLbl(objPrefix+"Lbl-"+TimeToStr(now,TIME_DATE)+"-"+StartTime+"-"+EndTime, "NO TRADE! ("+DoubleToStr(boxExtent/pip,0)+"p)", tBoxStart+(tBoxEnd-tBoxStart)/2,boxLow, 12, "Arial Black", LevelColor, 3);
} else {
drawBox (boxName,tBoxStart,boxLow,tBoxEnd,boxHigh,BoxColorMAX,1, STYLE_SOLID, true);
DrawLbl(objPrefix+"Lbl-"+TimeToStr(now,TIME_DATE)+"-"+StartTime+"-"+EndTime, "MAX LIMIT! ("+DoubleToStr(boxExtent/pip,0)+"p)", tBoxStart+(tBoxEnd-tBoxStart)/2,boxLow, 12, "Arial Black", LevelColor, 3);
}
} else if (boxExtent >= MinBoxSizeInPips * pip) { // box OK
drawBox (boxName,tBoxStart,boxLow,tBoxEnd,boxHigh,BoxColorOK,1, STYLE_SOLID, true);
DrawLbl(objPrefix+"Lbl-"+TimeToStr(now,TIME_DATE)+"-"+StartTime+"-"+EndTime, DoubleToStr(boxExtent/pip,0)+"p", tBoxStart+(tBoxEnd-tBoxStart)/2,boxLow, 12, "Arial Black", LevelColor, 3);
} else { // "Caution!" box
drawBox (boxName,tBoxStart,boxLow,tBoxEnd,boxHigh,BoxColorNOK,1, STYLE_SOLID, true);
DrawLbl(objPrefix+"Lbl-"+TimeToStr(now,TIME_DATE)+"-"+StartTimПоказано первые 50% кода (символов: 37897)
Открыть по тарифу
Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.
Разовая покупка файла
На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.
Зачем нужен email? После подтверждения оплаты файл сохранится в кабинете на этот email. Если аккаунта ещё нет, мы создадим его и пришлём ссылку для задания пароля. Если аккаунт уже есть, покупка добавится в него. Укажите адрес, к которому у вас есть доступ.
Чтобы оформить заказ, введите email и перейдите к оплате.