Ingen beskrivning

valFvgMt5.mq5 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. //+------------------------------------------------------------------+
  2. //| valFvgMt5.mq5 |
  3. //| Copyright 2025, MQL Development |
  4. //| https://www.mqldevelopment.com/ |
  5. //+------------------------------------------------------------------+
  6. #property copyright "Copyright 2025, MQL Development"
  7. #property link "https://www.mqldevelopment.com/"
  8. #property version "1.00"
  9. #include <Trade\Trade.mqh>
  10. CTrade trade;
  11. #resource "\\Indicators\\SequentialVolumeProfileWithFVG.ex5"
  12. #define previousBullish "previousBullish"
  13. #define previousBearish "previousBearish"
  14. //+------------------------------------------------------------------+
  15. //| Expert initialization function |
  16. //+------------------------------------------------------------------+
  17. enum lotcalculator
  18. {
  19. fix, //Fixed Lot Size
  20. rsk, //Risk Percentage
  21. };
  22. enum tp_options
  23. {
  24. zone_based, // Zone Based Tp
  25. risk_reward_based, // Risk to Reward
  26. };
  27. enum sl_options
  28. {
  29. zone_based_sl, // Zone Based Sl
  30. fvg_third, // FVG third candle high and low + buffer
  31. };
  32. sinput string string_0 = "<><><><><><> General SETTINGS <><><><><><>"; //__
  33. input int magic_no = 333; // Magic no
  34. input tp_options select_tp = zone_based; // Select Tp
  35. input sl_options select_sl = zone_based_sl; // Select Sl
  36. input double stoploss = 4; // FVG Third High/Low Stop Loss in Buffer
  37. input double tpMultiplier = 2; // Take Profit Multiplier Risk to Reward
  38. input string string_0_3 = "<><><><><><> Lot Management<><><><><><>"; //__
  39. input double lot_size = 0.1; // Lot Size
  40. input lotcalculator lot_calculator = fix; // Lot Size Calculator
  41. input double risk = 0.1; // Risk in Percentage %
  42. input string time_setting = "<><><><><> Time Filter Settings <><><><><>"; //_
  43. input bool EnableTimeFilter = false; // Enable Time Filter
  44. input string startTime = "03:00"; // Start Time Session
  45. input string endTime = "09:00"; // End Time Session
  46. sinput string string_1 = "<><><><><><> Sequential Volume Indicator SETTINGS <><><><><><>"; //__
  47. input int BinsCount = 100; // Number of price bins
  48. input double ValueAreaPercent = 70; // Value Area percentage (70% default)
  49. input color VALColor = clrDarkBlue; // Value Area Low color
  50. input color VAHColor = clrDarkBlue; // Value Area High color
  51. input color AbsLowColor = clrBlack; // Absolute Low color
  52. input color AbsHighColor = clrBlack; // Absolute High color
  53. input color TimeLineColor = clrRed; // Time marker line color
  54. input int LineWidth = 2; // Line width for all value lines
  55. input int TimeLineWidth = 2; // Line width for time marker lines
  56. input int MaxDaysBack = 30; // Maximum number of trading days to look back
  57. input ENUM_LINE_STYLE VALStyle = STYLE_SOLID; // Value Area Low line style
  58. input ENUM_LINE_STYLE VAHStyle = STYLE_SOLID; // Value Area High line style
  59. input ENUM_LINE_STYLE AbsLowStyle = STYLE_SOLID; // Absolute Low line style
  60. input ENUM_LINE_STYLE AbsHighStyle = STYLE_SOLID; // Absolute High line style
  61. input bool ShowLabels = true; // Show price labels
  62. input bool ShowComment = true; // Show comment with most recent levels
  63. input bool ShowFVG = true; // Enable Fair Value Gap detection
  64. input color BullishFVGColor = clrLime; // Bullish FVG color
  65. input color BearishFVGColor = clrDeepPink; // Bearish FVG color
  66. input double MinFVGSize = 0.0; // Minimum FVG size in points (0 = any size)
  67. input int MaxBarsBack = 300; // How many bars to look back for FVG
  68. input string fvg_setting = "<><><><><> FVG Color Setting <><><><><>"; //_
  69. input color bullish_color = clrAqua; // Bullish FVG Color
  70. input color bearish_color = clrYellow; // Bearish FVG Color
  71. // Global Variables
  72. int sequential_handler;
  73. datetime startTradingTime = 0, endTradingTime = 0;
  74. string sep = ":"; // A separator as a character
  75. ushort u_sep; // The code of the separator character
  76. string result1[];
  77. //+------------------------------------------------------------------+
  78. //| |
  79. //+------------------------------------------------------------------+
  80. int OnInit()
  81. {
  82. //---
  83. trade.SetExpertMagicNumber(magic_no);
  84. trade.SetDeviationInPoints(10);
  85. trade.SetTypeFilling(ORDER_FILLING_IOC);
  86. trade.LogLevel(LOG_LEVEL_ALL);
  87. trade.SetAsyncMode(false);
  88. sequential_handler = iCustom(Symbol(), PERIOD_CURRENT, "::Indicators\\SequentialVolumeProfileWithFVG.ex5",
  89. BinsCount,
  90. ValueAreaPercent,
  91. VALColor,
  92. VAHColor,
  93. AbsLowColor,
  94. AbsHighColor,
  95. TimeLineColor,
  96. LineWidth,
  97. TimeLineWidth,
  98. MaxDaysBack,
  99. VALStyle,
  100. VAHStyle,
  101. AbsLowStyle,
  102. AbsHighStyle,
  103. ShowLabels,
  104. ShowComment,
  105. ShowFVG,
  106. BullishFVGColor,
  107. BearishFVGColor,
  108. MinFVGSize,
  109. MaxBarsBack);
  110. //---
  111. return(INIT_SUCCEEDED);
  112. }
  113. //+------------------------------------------------------------------+
  114. //| Expert deinitialization function |
  115. //+------------------------------------------------------------------+
  116. void OnDeinit(const int reason)
  117. {
  118. //---
  119. }
  120. //+------------------------------------------------------------------+
  121. //| Expert tick function |
  122. //+------------------------------------------------------------------+
  123. void OnTick()
  124. {
  125. //---
  126. double values[];
  127. CopyBuffer(sequential_handler,0,0,3,values);
  128. double val = lines("VAL");
  129. double vah = lines("VAH");
  130. double absHigh = lines("AbsHigh");
  131. double absLow = lines("AbsLow");
  132. // Print("Val: ", val, " Vah: ", vah, " AbsHigh: ", absHigh, " AbsLow: ", absLow);
  133. double Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
  134. double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
  135. timeConversion();
  136. if((EnableTimeFilter && TimeCurrent() >= startTradingTime && TimeCurrent() < endTradingTime) || !EnableTimeFilter)
  137. {
  138. if(newBar())
  139. {
  140. string gapCreated = fvg_gap();
  141. if(todayTradesCount(DEAL_TYPE_BUY) == 0)
  142. {
  143. if(gapCreated == previousBullish)
  144. {
  145. double open_2 = iOpen(Symbol(), PERIOD_CURRENT, 2);
  146. double close_2 = iClose(Symbol(), PERIOD_CURRENT, 2);
  147. double upper_price = MathMax(open_2, close_2);
  148. double lower_price = MathMin(open_2, close_2);
  149. if(((upper_price > val) && (lower_price < val)) || ((upper_price < val) && (lower_price < val)))
  150. {
  151. placeBuyTrade();
  152. }
  153. }
  154. }
  155. if(todayTradesCount(DEAL_TYPE_SELL) == 0)
  156. {
  157. if(gapCreated == previousBearish)
  158. {
  159. double open_2 = iOpen(Symbol(), PERIOD_CURRENT, 2);
  160. double close_2 = iClose(Symbol(), PERIOD_CURRENT, 2);
  161. double upper_price = MathMax(open_2, close_2);
  162. double lower_price = MathMin(open_2, close_2);
  163. if(((upper_price > vah) && (lower_price < vah)) || ((upper_price > vah) && (lower_price > vah)))
  164. {
  165. placeSellTrade();
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. //+------------------------------------------------------------------+
  173. //| |
  174. //+------------------------------------------------------------------+
  175. void timeConversion()
  176. {
  177. MqlDateTime date, date1;
  178. TimeToStruct(iTime(Symbol(),PERIOD_CURRENT,0),date);
  179. u_sep=StringGetCharacter(sep,0);
  180. StringSplit(startTime,u_sep,result1);
  181. date.hour = (int)StringToInteger(result1[0]);
  182. date.min = (int)StringToInteger(result1[1]);
  183. startTradingTime = StructToTime(date);
  184. TimeToStruct(iTime(Symbol(),PERIOD_CURRENT,0),date1);
  185. StringSplit(endTime,u_sep,result1);
  186. date.hour = (int)StringToInteger(result1[0]);
  187. date.min = (int)StringToInteger(result1[1]);
  188. endTradingTime = StructToTime(date);
  189. }
  190. //+------------------------------------------------------------------+
  191. //| |
  192. //+------------------------------------------------------------------+
  193. double lines(string name)
  194. {
  195. datetime todayStart = iTime(Symbol(), PERIOD_D1, 0);
  196. datetime nextDayStart = todayStart + 86400;
  197. datetime latestObjectTime = 0;
  198. for(int i = 0; i < ObjectsTotal(0, 0, OBJ_TREND); i++)
  199. {
  200. string object_name = ObjectName(0, i, 0, OBJ_TREND);
  201. datetime object_time = (datetime)ObjectGetInteger(0, object_name, OBJPROP_TIME, 1);
  202. if(object_time > todayStart && object_time < nextDayStart)
  203. {
  204. // Print(" Object Name: ", object_name, " Day Start Time: ", todayStart, " Next Day Time: ", nextDayStart);
  205. if((StringFind(object_name, name) != -1))
  206. {
  207. double objectPrice = ObjectGetDouble(0, object_name, OBJPROP_PRICE, 0);
  208. return objectPrice;
  209. }
  210. }
  211. }
  212. return 0;
  213. }
  214. //+------------------------------------------------------------------+
  215. //| |
  216. //+------------------------------------------------------------------+
  217. bool fvgOverLap(string name, double price_overlap)
  218. {
  219. datetime todayStart = iTime(Symbol(), PERIOD_D1, 0);
  220. datetime nextDayStart = todayStart + 86400;
  221. for(int i = 0; i < ObjectsTotal(0, 0, OBJ_RECTANGLE); i++)
  222. {
  223. string object_name = ObjectName(0, i, 0, OBJ_RECTANGLE);
  224. datetime object_time1 = (datetime)ObjectGetInteger(0, object_name, OBJPROP_TIME, 1);
  225. datetime object_time0 = (datetime)ObjectGetInteger(0, object_name, OBJPROP_TIME, 0);
  226. double object_price0 = ObjectGetDouble(0, object_name, OBJPROP_PRICE, 0);
  227. double object_price1 = ObjectGetDouble(0, object_name, OBJPROP_PRICE, 1);
  228. if(object_time1 > todayStart && object_time1 < nextDayStart)
  229. {
  230. if((StringFind(object_name, name) != -1))
  231. {
  232. double fvg_top = MathMax(object_price0, object_price1);
  233. double fvg_bottom = MathMin(object_price0, object_price1);
  234. if(fvg_top > price_overlap && fvg_bottom < price_overlap)
  235. {
  236. Print(" Called By: (", name, ") Object Name: ", object_name,
  237. " | Time 0: ", TimeToString(object_time0), " | Price 0: ", object_price0,
  238. " | Time 1: ", TimeToString(object_time1), " | Price 0: ", object_price0, " | Price 1: ", object_price1, " | \n FVG Top: ", fvg_top, " | FVG Bottom: ", fvg_bottom);
  239. return true;
  240. }
  241. }
  242. }
  243. }
  244. return false;
  245. }
  246. //+------------------------------------------------------------------+
  247. //| |
  248. //+------------------------------------------------------------------+
  249. int todayTradesCount(ENUM_DEAL_TYPE dealType)
  250. {
  251. int count = 0;
  252. ulong ticket_deal_Out=0, ticket_deal_In = 0;
  253. if(HistorySelect(iTime(Symbol(),PERIOD_D1,0), TimeCurrent()))
  254. {
  255. int total = HistoryDealsTotal();
  256. for(int i = total-1; i >= 0 ; i--)
  257. {
  258. ticket_deal_In = HistoryDealGetTicket(i);
  259. if((HistoryDealGetInteger(ticket_deal_In,DEAL_MAGIC) == magic_no) && HistoryDealGetInteger(ticket_deal_In,DEAL_ENTRY) == DEAL_ENTRY_IN
  260. && HistoryDealGetString(ticket_deal_In,DEAL_SYMBOL) == Symbol()) // here is the problem solved after break
  261. {
  262. if(HistoryDealGetInteger(ticket_deal_In, DEAL_TYPE) == dealType)
  263. {
  264. count++;
  265. }
  266. }
  267. }
  268. }
  269. return count;
  270. }
  271. //+------------------------------------------------------------------+
  272. //| |
  273. //+------------------------------------------------------------------+
  274. void placeBuyTrade()
  275. {
  276. double buySL = 0, buyTp=0;
  277. //openPrice = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
  278. double Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
  279. double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
  280. //if(stoploss != 0)
  281. // {
  282. // buySL = Ask - (stoploss * 10 * Point());
  283. // }
  284. if(select_sl == zone_based_sl)
  285. {
  286. buySL = lines("AbsLow");
  287. }
  288. if(select_sl == fvg_third)
  289. {
  290. //if(stoploss != 0)
  291. {
  292. buySL = iLow(Symbol(), PERIOD_CURRENT, 3) - (stoploss * 10 * Point());
  293. }
  294. }
  295. if(select_tp == zone_based)
  296. {
  297. buyTp = lines("VAH");
  298. }
  299. if(select_tp == risk_reward_based)
  300. {
  301. double distance = MathAbs((Ask - buySL) / Point());
  302. distance = (distance * tpMultiplier);
  303. buyTp = Ask + (distance * Point());
  304. }
  305. //if(takeprofit != 0)
  306. // {
  307. // buyTp = Ask + (takeprofit * 10 * Point());
  308. // }
  309. double distance_sl = MathAbs((Ask - buySL) / Point());
  310. if(trade.PositionOpen(Symbol(),ORDER_TYPE_BUY,getlot(distance_sl),Ask,buySL,buyTp,"Buy Trade Placed"))
  311. {
  312. Print("Buy Trade Placed: ",trade.ResultOrder());
  313. }
  314. else
  315. {
  316. Print("Error in placing Buy: "+Symbol()+" ",GetLastError());
  317. }
  318. }
  319. //+------------------------------------------------------------------+
  320. //| |
  321. //+------------------------------------------------------------------+
  322. void placeSellTrade()
  323. {
  324. double sellSL = 0, sellTp = 0;
  325. //openPrice = SymbolInfoDouble(Symbol(),SYMBOL_BID);
  326. double Ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
  327. double Bid = SymbolInfoDouble(Symbol(),SYMBOL_BID);
  328. //if(stoploss != 0)
  329. // {
  330. // sellSL = Bid + (stoploss * 10 * Point());
  331. // }
  332. if(select_sl == zone_based_sl)
  333. {
  334. sellSL = lines("AbsHigh");
  335. }
  336. if(select_sl == fvg_third)
  337. {
  338. //if(stoploss != 0)
  339. {
  340. sellSL = iHigh(Symbol(), PERIOD_CURRENT, 3) + (stoploss * 10 * Point());
  341. }
  342. }
  343. //if(takeprofit != 0)
  344. // {
  345. // sellTp = Bid - (takeprofit * 10 * Point());
  346. // }
  347. if(select_tp == zone_based)
  348. {
  349. sellTp = lines("VAL");
  350. }
  351. if(select_tp == risk_reward_based)
  352. {
  353. double distance = MathAbs((Bid - sellSL) / Point());
  354. distance = (distance * tpMultiplier);
  355. sellTp = Bid - (distance * Point());
  356. }
  357. double distance_sl = MathAbs((Bid - sellSL) / Point());
  358. if(trade.PositionOpen(Symbol(),ORDER_TYPE_SELL,getlot(distance_sl),Bid,sellSL,sellTp,"Sell Trade Placed"))
  359. {
  360. Print("Sell Trade PLaced: ",trade.ResultOrder());
  361. }
  362. else
  363. {
  364. Print("Error in placing Sell: "+Symbol()+" ",GetLastError());
  365. }
  366. }
  367. //+------------------------------------------------------------------+
  368. //| |
  369. //+------------------------------------------------------------------+
  370. double getlot(double stop_loss)
  371. {
  372. Print("Tick Value: ",SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE));
  373. Print("Tick Size: ",SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE));
  374. double modeTickV=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE)
  375. ,modeTickS=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE);
  376. // Print("Pip value: ", NormalizeDouble(((SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE)/(SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE)/Point))*10),2));
  377. double pipvalue = NormalizeDouble(((SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE)/(SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_SIZE)/Point()))*10),2);
  378. // pipvalue=NormalizeDouble((modeTickV/modeTickS/Point()),)
  379. // pipvalue=
  380. pipvalue = pipvalue / 10;
  381. double lotSize = lot_size;
  382. if(lot_calculator==rsk) //calculating risk
  383. {
  384. double riskamount=(risk/100)*AccountInfoDouble(ACCOUNT_BALANCE);
  385. double pipvalue_required=riskamount/stop_loss;
  386. lotSize = pipvalue_required/pipvalue;
  387. //sl=riskamount/pipValuelot
  388. int roundDigit=0;
  389. double step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
  390. while(step<1)
  391. {
  392. roundDigit++;
  393. step=step*10;
  394. }
  395. Print("Round Digits:",roundDigit);
  396. lotSize = NormalizeDouble(lotSize,roundDigit);
  397. //
  398. }
  399. Print("Lot Size: ",lotSize);
  400. if(lotSize > SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX))
  401. {
  402. lotSize=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
  403. }
  404. else
  405. if(lotSize<SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN))
  406. {
  407. lotSize=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
  408. }
  409. //---
  410. return lotSize;
  411. }
  412. //+------------------------------------------------------------------+
  413. //| |
  414. //+------------------------------------------------------------------+
  415. string check_bearish_bullish()
  416. {
  417. int bullishCount = 0;
  418. int bearishCount = 0;
  419. for(int i = 1; i <= 3; i++)
  420. {
  421. double open = iOpen(Symbol(), PERIOD_CURRENT, i);
  422. double close = iClose(Symbol(), PERIOD_CURRENT, i);
  423. if(close > open)
  424. {
  425. bullishCount++;
  426. }
  427. else
  428. if(close < open)
  429. {
  430. bearishCount++;
  431. }
  432. }
  433. // Output the result
  434. if(bullishCount > bearishCount)
  435. {
  436. return previousBullish;
  437. }
  438. else
  439. if(bearishCount > bullishCount)
  440. {
  441. return previousBearish;
  442. }
  443. else
  444. {
  445. return NULL;
  446. }
  447. }
  448. //+------------------------------------------------------------------+
  449. //| |
  450. //+------------------------------------------------------------------+
  451. string fvg_gap()
  452. {
  453. //Print("Imbalance: ");
  454. if(check_bearish_bullish() == previousBullish)
  455. {
  456. if(iLow(Symbol(), PERIOD_CURRENT, 1) > iHigh(Symbol(), PERIOD_CURRENT, 3))
  457. {
  458. //double fvg_body = imbalance_gap * 10; // FVG Body
  459. double fvg_size = MathAbs((iLow(Symbol(), PERIOD_CURRENT, 1) - iHigh(Symbol(), PERIOD_CURRENT, 3))/Point());
  460. //fvg_size = fvg_size * 10 * Point();
  461. //if(fvg_size > fvg_body)
  462. {
  463. if(!ObjectCreate(0, "Buy" + (string) TimeCurrent(), OBJ_RECTANGLE, 0, iTime(Symbol(), PERIOD_CURRENT, 3), iHigh(Symbol(), PERIOD_CURRENT, 3), iTime(Symbol(), PERIOD_CURRENT, 1), iLow(Symbol(), PERIOD_CURRENT, 1)))
  464. {
  465. Print(" Error in Drawing Buy Rectangle : "," rectangle "+(string)iTime(Symbol(),PERIOD_CURRENT,1)," ",GetLastError());
  466. }
  467. else
  468. {
  469. ObjectSetInteger(0, "Buy"+ (string) TimeCurrent(), OBJPROP_COLOR, bullish_color);
  470. ObjectSetInteger(0,"Buy"+ (string) TimeCurrent(), OBJPROP_FILL, true);
  471. //ObjectSetInteger(0,"Range",OBJPROP_BACK,false);
  472. Print("Bullish Fvg Body Size: ", fvg_size, " Name: ", "Buy" + (string) TimeCurrent());
  473. return previousBullish;
  474. }
  475. }
  476. }
  477. }
  478. if(check_bearish_bullish() == previousBearish)
  479. {
  480. if(iLow(Symbol(), PERIOD_CURRENT, 3) > iHigh(Symbol(), PERIOD_CURRENT, 1))
  481. {
  482. //double fvg_body = imbalance_gap * 10; // FVG Body
  483. double fvg_size = MathAbs((iLow(Symbol(), PERIOD_CURRENT, 3) - iHigh(Symbol(), PERIOD_CURRENT, 1))/Point());
  484. //fvg_size = fvg_size * 10 * Point();
  485. //if(fvg_size > fvg_body)
  486. {
  487. if(!ObjectCreate(0, "Sell" + (string) TimeCurrent(), OBJ_RECTANGLE, 0, iTime(Symbol(), PERIOD_CURRENT, 3), iLow(Symbol(), PERIOD_CURRENT, 3), iTime(Symbol(), PERIOD_CURRENT, 1), iHigh(Symbol(), PERIOD_CURRENT, 1)))
  488. {
  489. Print(" Error in Drawing Sell Rectangle : "," rectangle "+(string)iTime(Symbol(),PERIOD_CURRENT,1)," ",GetLastError());
  490. }
  491. else
  492. {
  493. ObjectSetInteger(0, "Sell"+ (string) TimeCurrent(), OBJPROP_COLOR, bearish_color);
  494. ObjectSetInteger(0,"Sell"+ (string) TimeCurrent(), OBJPROP_FILL, true);
  495. //ObjectSetInteger(0,"Range",OBJPROP_BACK,false);
  496. Print("Bearish Fvg Body Size: ", fvg_size, " Name: ", "Buy" + (string) TimeCurrent());
  497. return previousBearish;
  498. }
  499. }
  500. }
  501. }
  502. return NULL;
  503. }
  504. //+------------------------------------------------------------------+
  505. //| |
  506. //+------------------------------------------------------------------+
  507. bool newBar()
  508. {
  509. static datetime lastbar;
  510. datetime curbar = iTime(Symbol(), PERIOD_CURRENT, 0);
  511. if(lastbar != curbar)
  512. {
  513. lastbar = curbar;
  514. Print("<<<<<<<<>>>>>>>>>>>>New Bar Time V1.1. ", curbar, "<<<<<<<<>>>>>>>>>>>>");
  515. return (true);
  516. }
  517. else
  518. {
  519. return (false);
  520. }
  521. }
  522. //+------------------------------------------------------------------+
  523. //| |
  524. //+------------------------------------------------------------------+
  525. //+------------------------------------------------------------------+