Connection Monitor with login action

MQL5 Indicators Scripts

Specification

Name: Paranoid Connection Monitor

Purpose: Prevent disconnections of terminal or long breaks in tick stream

Why: The terminal automatically attempts to login if it notices it is disconnected. The time before terminal find it self disconnected is depending on TCP/IP settings of the operating system. The time is long and a lot can happen.


This software would calculate the average tick interval and if tick is not received in a time depending on the average, it performs a login of the terminal (or rescan).


Challenges:

  • To my knowledge there is no function for login in MQL4. But the solution can be found here http://forum.mql4.com/15325#101492

  • Indicator start() function is called up on arrival of a new tick. Therefore an Indicator can not wait nor perform a task (e.g. login) if a tick does not arrive. I think this could be solved with a Script polling General Variables to which an Indicator writes.

System Description

The average tick interval is calculated over number of ticks (TicksInAverage) in the Indicator. The interval and time of the last tick (TimeOfLastTick) is then made available for the Script. To my restricted knowledge MQL4 does not support events triggered in Script from an Indicator. That would be better than my algorithm below which I use here for the sole purpose describing the function, not necessarily the code that I would like have.


User sets variables: TicksInAverage, TimeOutFactor


The initialisations are not addressed here.


AvgInterval() Returns latest value TicksInAverage in Indicator

TimeOfLastTick() Return latest value TimeOfLastTick in Indicator

SkipNextTick() Communicates to Indicator

TakeAction() It's a timeout. Take action. Function contain code both to do a login and rescan. The choice is made before compiling by turning one or the other section of code to comments (//).


Variable TimeLeft, TimeCpy

Loop { TimeLeft = AvgInterval() x TimeOutFactor - current time - TimeOfLastTick()

if TimeLeft<0

{ TimeCpy=TimeOfLastTick()

TakeAction()

SkipNextTick(TRUE)

whilst TimeCpy==TimeOfLastTick() {sleep(AvgInterval())}

}

else

{ sleep(TimeLeft)

}

}



The Indicator would have a function off:


AvgInterval() calculates average interval and communicates it to Script

TimeOfLastTick() communicates time of last tick to Script

SkipNextTick() communicate from Script if next tick should be skipped

Variables Interval

loop

{ Interval = tick time – TimeOfOldTick

TimeOfLastTick()

if FALSE==SkipNextTick()

{ AvgInterval(Interval)

}

TimeOfOldTick= tick time

}



Preliminary Requirements Specification

  • Name: Paranoid Connection Monitor

  • To work on windows 2003 and written in MQL4. Expert Advisor, Indicator and/or script

  • Risks to unsuccessful login or rescan shall be addressed by coder. E.g. Does simulated key strokes pose a risk and why. This Requirements Specification may be edited accordingly.

  • A login or rescan shall take place when average tick interval X a factor (TimeOutFactor) is exceeded. The initiation of login or rescan shall take place before average tick interval X (TimeOutFactor+1) provided enough CPU speed.

  • The average tick interval shall be calculated using a certain amount of ticks (TicksInAverage)

  • The average tick interval shall not take into account interval in between two ticks separated by a login or rescan

  • A log file shall be written (text or CSV) containing following information separated with Tab or “;” . Date, Login Start , average tick interval, Login end time. E.g.:

    19/02/2012 Interval 0.3 Start 19:03:32 End 19:03:47

    Login is considered completed / ended after first received tick

  • User can set varibales TimeOutFactor, TicksInAverage

  • A method of restarting the terminal in case of longer connection loss shall be described by coder and necessary tools provided. This may not have anything to do with the actual Paranoid Connection Monitor it self. But should be provided as extra guard.


Similar orders
1. I want function that will use the totalBuyLots and totalSellLots to place trades when there is reverse trade direction. For example, if there is an open trade of buy, 0.1, 0.1, 0.1, then if the trade direction change to sell, meaning a sell trad is opened, then the totalBuyLots which now 0.3 will be used to open the sell of 0.3 lots. Same if a sell trade is opened first, then total lots will be use d when
Hello Sir - I am looking for some thing like this. 1- Moving Average MA value as line on Chart with label. i.e. 5min, 50, Exponential ( Labels should be selectable, Hide / Unhide, or display on Right / Left) 2- The line colors and style should be selectable. 3- Alert if price equals to MA Value. Please mention if you will be sharing code with me for future improvements
Seeking an expert in LSTM (Long Short-Term Memory) for MT4 to implement the most cutting-edge and advanced form of LSTM with full feature integration. The ideal candidate will possess extensive experience in leveraging LSTM technology within MT4, ensuring optimal performance and profitability. Join us in revolutionizing trading strategies with state-of-the-art LSTM algorithms tailored for MT4. Add a zig zag to the
Please note that my budget is for both mt4 and mt5 platforms The EA should have 1. An option that I can change it parameters, that's the period, method and application 2. The EA should sell when on every bullish candle that closes under the MA 3. The EA should buy on every bearish candle that forms Above the EA. It's should close trades on reverse cross. I mean when it's in a buy trade and crosses the MA for a sell
Looking for experienced developer to fix and check the indicator functions in my EA. Main problem to fix is that there is option to open new trade at close of previous which doen't always work on one of the indicators - depending on user inputs. Also if trading is disabled using AutoTrading button, then re enabled the EA waits for new signal to start, but it needs to place trade immediately according to current
I have an EA which trades with XAUUSD with a grid system, and I need to add a few features: 1.- The EA works with an indicator and open many trades as a grid system. I need the EA to open JUST 1 TRADE INMEDIATELY WHEN THE TREND SHOWS. 2.- I need the EA to keep that trade open until it reaches TP or the reverse signal shows. The EA has already the 'close if reverse signal' parameter. 3.- I need to create a parameter
I wanted to convert from mt4 to Ctrader Cbot and you want a particular option/feature to work as a bot. A nd can you update this point: the option to check the account name/number on which the CBOT will work, if the wrong account number is given the CBOT should not work
Can you convert TradingView Harmonic pattern indicator to ninjatrader8? and I don not need statistic table with numbers, just indicators pattern, PRZ box (predicted prize box) etc. just no tables with numbers
I need a developer that can fix a indicator i have, I have a table that looks at emas and display bullish/bearish, I have spy on the table but its not always updating and need help fixing this I have this table and the first 6 rows looks at the chart symbol and if price is above 12 ema it will sows bullish under the 5/12 ema coulmn and bullish if its above, and same under the 34/50 colmun, if price is below 50 ema
I need a developer that can fix a indicator i have, I have a table that looks at emas and display bullish/bearish, I have spy on the table but its not always updating and need help fixing this I have this table and the first 6 rows looks at the chart symbol and if price is above 12 ema it will sows bullish under the 5/12 ema coulmn and bullish if its above, and same under the 34/50 colmun, if price is below 50 ema

Project information

Budget
50 - 150 USD
For the developer
45 - 135 USD
Deadline
from 1 to 20 day(s)