• Overview
  • Reviews
  • Comments
  • What's new

SymbolSynthesizer OrderPanel

It synthesizes any symbol if you have the source symbols in Market Watch window. This is the Order Panel for that. Same concept with symbolsynthesizer.mq5 (https://www.mql5.com/en/code/909), but a lot more functions. First design was to use with SymbolSynthesizer_Chart.mq4 (https://www.mql5.com/en/code/14596). You can download it free. And then generate a real-time off-line chart for the pair symbol you want to synthesize, please refer to the explanation on the link above. You can attach this EA on the generated chart. If you do so, the synthesized symbol and source symbols will be set automatically by the chart setting. Also show ask line and trade levels. You can use this panel also without virtual chart, but not with drag'n drop controls and pending order function.

When you click "Buy" or "Sell" button, the panel will entry two positions. One is source symbol 1 with preset lots, and also source symbol 2 with the automatically calculated lots. So they make virtual position for the synthesized symbol. If it's on the synthesized chart, SL/TP are modifiable by drag'n drop like any MT4 online charts, but after selected by double click. If you move the Buy entry line to the above, the TP line will be there. Move down makes (if SL does not exist) or moves SL line. Pending Order can be put by 2 steps. First click either "Pending Sell" button or "Pending Buy" button, and then click on the price you want to put the order in the chart. For example, if you click "Pending Buy" and you click above the Ask line, it will be pending Buy-Stop order, but if click below the Ask line, it will be pending Buy-Limt order.

Only one order or position for one chart.

So, if you want to open multiple positions for same symbol, you need to synthesize different name symbol with different magic but same source symbols. Or different source symbols for opposite position if your broker doesn't like hedge.

Note: SL/TP are not on the server side, they are on the EA which is attached. Thus if you close your MT4 or the chart, they are not going to work. Same thing for pending order.

Input parameters:

  • Magic Number - The magic number
  • The digits for synthesized symbol - The digits for synthesized symbol.
  • Spread in point. 0 means current. - Since MetaTrader 4 history file doesn't have past spread data, we need them to determine Ask price for the case dividing to calculate the virtual prices.
  • Virtual symbol - The one you want to generate. Any name is OK but less than 11 characters.
  • string sSym01="EURUSD";//Source symbol 1 (This is NOT external variable, automatically set for attached chart symbol)
  • Source symbol 2 - Source symbol#2. It must have an exact same name on Market Watch include prefix and/or suffix.
  • Calculation method - The calculation to synthesize. "M" means "Multiply", or put "D" means "Divide".
  • Show Ask line - True for show Ask line, false for not. Ignored if chart is not the virtual one.
  • Show and operate Trade Levels - True for show trade levels, false for not.
  • Show Profit and Loss in Text - True for show text about position and profit or loss, false for not.
  • Preset Lots for symbol 1 - Default lots for source symbol 1
  • Preset Slippage in Points - Default slippage
  • Preset Stop Loss in Points - Default preset Stop Loss
  • Preset Take Profit in Points - Default preset Take Profit
  • Preset Trailing Stop Loss in Points - Default preset Trailing Stop

Examples for source symbols and synthesized symbol

If the virtual price of vSymbol can be calculated by sSym01 multiply sSym02, put "M".

Ex: vSymbol="EURUSD" sSym01="EURGBP" sSym02="GBPUSD"

vSymbol="EURJPY" sSym01="EURGBP" sSym02="GBPJPY"

vSymbol="EURJPY" sSym01="EURUSD" sSym02="USDJPY"

vSymbol="BTCJPY" sSym01="BTCUSD" sSym02="USDJPY"

Note: sSym01 and sSym02 can be switched with each other since we multiply them. Major pair should be sSym01 for more often ticks.

If the virtual price of vSymbol can be calculated by sSym02 divided by sSym01, put "D" or any other string but "M".

Ex: vSymbol="USDJPY" sSym01="EURUSD" sSym02="EURJPY"

vSymbol="ZARJPY" sSym01="USDZAR" sSym02="USDJPY"

vSymbol="EURUSD" sSym01="USDJPY" sSym02="EURJPY"

Note: sSym01 and sSym02 can NOT be switched with each other since we divide.

The currencies with under-bar are "media currency".

No reviews
Version 2.2 - 2016.02.09
LotAdjust parameter implemented to consider Thick Value and Digits difference.
Version 2.1 - 2016.01.29
Bug fixes in the algorithm.