Forum

Optimizing sortino ratio in OnTester() using genetic algorithms?

This is the code I have so far but for the sharpe ratio. int OnInit () { if ( IsTesting () || IsOptimization ()) GlobalVariableSet ( "InitialBalance" , AccountBalance ()); return ( 0 ); } void OnDeinit ( const int reason) { if ( IsTesting () || IsOptimization ()) GlobalVariableDel (

MQL4 optimizer: why does this happen after a while?

After a while, everything in my optimization returns zero. What could be wrong? Can metatrader only handle so many iterations

Can someone check my code?

https://www.mql5.com/en/code/14085 I used this code as a base and modified it to close the last trade of either OP_TYPE before opening the next. However, after a while the trade copier stops placing trades altogether. My modified source code is posted below

Trade copier

I've been looking all over the forum and codebase for a local trade copier that closes the last trade before opening the next but only of the current type (buy or sell). Can someone point me to one if you are familiar or share code? Thank you

Remote trade copier?

Hi, I'm looking for a remote trade copier that connects two metatrader accounts without having to reroute to an external server. I searched all of the options in the market place and all of the remote trade copiers connect to their shady external servers. Is it possible to copy trades remotely

News filter doesnt work....

I am trying to implement https://www.mql5.com/en/code/16308 So in my first function I do this, void firstfunction{ int switch_action= 99 ; if (compArray[ 0 ]== "buy" ) switch_action= 1 ; if (compArray[ 0 ] == "sell" ) switch_action= 0 ; if (compArray[ 0 ] == "close" )

How to use a local variable in another function MQL4/MQL5/C++

I am trying to use my variable switch_action which is computed in the zmq code (InterpretZmqMessage) and use it in my second function (secondfunction) #property strict #include <stdlib.mqh> #include <stderror.mqh> #include <WinUser32.mqh> datetime LastActiontime; #import "shell32.dll" int

Why do I have a delay in my code? Can somebody provide a possible improvement?

#property version "1.00" #property strict // Required: MQL-ZMQ from https://github.com/dingmaotu/mql-zmq #include <Zmq/Zmq.mqh> extern string PROJECT_NAME = "DWX_ZeroMQ_Example" ; extern string ZEROMQ_PROTOCOL = "tcp" ; extern string HOSTNAME = "*" ; extern int REP_PORT = 5555 ; extern int

How to use the value of a variable from one function into another?

Hi, I have a variable called switch_action in my OnTick function , you can see below how it is calculated. void OnTick () { int switch_action; int ticket=- 1 ; double price; double TradeSize; double SL; //--- //Open Buy Order, instant signal is tested first RefreshRates (); if