Voenix Bridge for MT4 + MT5

Voenix Bridge for MT4 + MT5

18 March 2022, 02:09
Lorentzos Roussos
0
187

The voenix bridge allows you to receive new patterns -that voenix finds- into other programs running on the same terminal.

  • The bridge will only deliver newly found patterns
  • It can deliver the initial pattern list upon startup if you choose so

To enable the bridge ,scroll down to the first input screen of voenix when attaching it , before it appears on the chart and turn the bridge on.

The info delivered contains : 

  • Pattern name
  • Pattern direction of the would be trade for that pattern (Bullish , Bearish) in string and directly usable type (OP_BUY/OP_SELL or ORDER_TYPE_BUY/ORDER_TYPE_SELL)
  • The symbol the pattern was found in
  • The timeframe the pattern was found in for that symbol , both in string and directly usable type (ENUM_TIMEFRAMES)
  • The time it was discovered
  • The would be trade levels resulting from your pattern settings (SL , TP1 , TP2 , TP3 and OP)
  • The status of the 5 indicators (true or false) for further filtration (rsi / macd / bollinger bands / stochastic / sr)
  • An array of all points of the pattern with price time and point decall (text X A B C etc)

 You may find the files for mt4 and mt5 below (attached) , and a sample usage code follows (from the mt4 files)

//+------------------------------------------------------------------+
//|                                             ReadingTheBridge.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include "VoenixBridge.mqh";
input uint read_interval=1000;//reading interval in milliseconds

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
bool has_timer=false,busy=false;
voenix_pattern_list BRIDGE;
//leave the following unchanged
  string Voenix_folder="VoenixInterim";
  string Voenix_bridge_folder="bridge";
  string Voenix_write_indicator="wi.txt";
  string Voenix_rolling_name="r.txt";
  string Voenix_new_data_flag="nd.txt";
int OnInit()
  {
  
  BRIDGE.reset();
  busy=false;
  has_timer=EventSetMillisecondTimer(read_interval);
  if(!has_timer){return(INIT_FAILED);}  
  return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  BRIDGE.reset();
  if(has_timer){EventKillTimer();}
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
  if(!busy)
   {
   busy=true;
   
   bool new_patterns=BRIDGE.load(Voenix_folder,Voenix_bridge_folder,Voenix_write_indicator,Voenix_rolling_name,Voenix_new_data_flag,true,100);
   //if new patterns have been loaded
     if(new_patterns)
     {
     //getting the amount of new patterns 
       int patterns_returned=ArraySize(BRIDGE.patterns);
     //checking if the return is an initial load or newly discovered patterns 
       bool is_initial_list=BRIDGE.initial_load;
       Print("Found "+IntegerToString(patterns_returned)+" Patterns");
       Print("Is initial list "+BoolToString(is_initial_list));
     //Looping inside the patterns 
       for(int p=0;p<ArraySize(BRIDGE.patterns);p++)
       {
       //test prints , you can remove or comment them out 
       Print("Pattern ["+IntegerToString(p+1)+"]");
       //pattern name 
         Print("Name : "+BRIDGE.patterns[p].name.to_string());
       //pattern symbol
         Print("Symbol : "+BRIDGE.patterns[p].symbol.to_string());
       //pattern timeframe text 
         Print("Timeframe : "+BRIDGE.patterns[p].timeframe_text.to_string());
         // note there are 2 timeframe branches , one is in text format -like above- for display and the other 
         // is in ENUM_TIMEFRAMES type for immediate use BRIDGE.patterns[p].timeframe 
       //direction -of the would be trade for this pattern-
         Print("Direction : "+BRIDGE.patterns[p].direction_text.to_string());
         // note the direction text can be Bullish or Bearish and its for display purposes . Like the timeframes branch 
         // an immediate use form exists in BRIDGE.patterns[p].direction and can be OP_BUY or OP_SELL respectively 
       //discovery time -not the last point time- 
         Print("Discovered : "+TimeToString(BRIDGE.patterns[p].discovery_time,TIME_DATE|TIME_MINUTES|TIME_SECONDS)); 
       //filter states for indicators 
         Print("RSI "+BoolToString(BRIDGE.patterns[p].rsi)+" MACD "+BoolToString(BRIDGE.patterns[p].macd)+" BANDS "+BoolToString(BRIDGE.patterns[p].bb)+" STOCHASTIC "+BoolToString(BRIDGE.patterns[p].sto)+" S/R "+BoolToString(BRIDGE.patterns[p].sr));
       //price levels
         Print("SL  : "+DoubleToString(BRIDGE.patterns[p].sl,BRIDGE.patterns[p].asset_digits));
         Print("OP  : "+DoubleToString(BRIDGE.patterns[p].op,BRIDGE.patterns[p].asset_digits));
         Print("TP1 : "+DoubleToString(BRIDGE.patterns[p].tp1,BRIDGE.patterns[p].asset_digits));
         Print("TP2 : "+DoubleToString(BRIDGE.patterns[p].tp2,BRIDGE.patterns[p].asset_digits));
         Print("TP3 : "+DoubleToString(BRIDGE.patterns[p].tp3,BRIDGE.patterns[p].asset_digits));
       //export points of the pattern 0 is the leftmost , total-1 is the rightmost point 
         //total points in pattern
         int total_points=ArraySize(BRIDGE.patterns[p].points);
         Print("Total pattern points : "+IntegerToString(total_points));
         for(int po=0;po<total_points;po++)
         {
         //a point has the price the time and the decall (i.e. X , A , B , C ... etc) 
           Print("Point ["+IntegerToString(po+1)+"]["+BRIDGE.patterns[p].points[po].decall.to_string()+"] Price : "+DoubleToString(BRIDGE.patterns[p].points[po].price,BRIDGE.patterns[p].asset_digits));
           Print("Point ["+IntegerToString(po+1)+"]["+BRIDGE.patterns[p].points[po].decall.to_string()+"] Time  : "+TimeToString(BRIDGE.patterns[p].points[po].time,TIME_DATE|TIME_MINUTES|TIME_SECONDS));
         }  
       }
     //Looping inside the patterns ends here 
     }
   //if new patterns have been loaded ends here 
   busy=false;
   } 
  }


Share it with friends: