Are there volunteers or freelance that are available to convert MQL4 codes to C#?
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
Volunteers/freelancers needed to convert MQL4 to C# for QuantConnect.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
Converting MQL4 code to C# for QuantConnect
Uncle bob | uncle bob | January 2015
Are there volunteers or freelance that are available to convert MQL4 codes to C#?
QuantConnectâ„¢ 2025. All Rights Reserved
Uncle bob
using System; using CodeBase; using Interfaces; using System.Drawing; using System.ComponentModel; namespace UserCode { [Serializable] public class Moving Average : EABase { #region Properties #endregion //+------------------------------------------------------------------+ //| expert default constructor. DO NOT REMOVE | //+------------------------------------------------------------------+ public Moving Average() { copyright = "2005-2014, MetaQuotes Software Corp."; link = "http://www.mql4.com"; description = "Moving Average sample expert advisor"; } private const double MAGICMA = 20131111 ; input double Lots =0.1; input double MaximumRisk =0.02; input double DecreaseFactor=3; input int MovingPeriod =12; input int MovingShift =6; int CalculateCurrentOrders(string symbol) { int buys=0,sells=0; int i; for(i=0;i0) return(buys);
else return(-sells);
}
double LotsOptimized()
{
double lot=Lots;
int orders=HistoryTotal();
int losses=0;
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
if(DecreaseFactor>0)
{
int i;
for(i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
{
Print("Error in history!");
break;
}
if(OrderSymbol()!=Symbol() | OrderType()>OP_SELL)
continue;
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1)
lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
if(lot<0.1) lot=0.1;
return(lot);
}
void CheckForOpen()
{
double ma;
int res;
if(Volume[0]>1) return;
ma=iMA(null,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
if(Open[1]>ma & Close[1]ma)
{
res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue);
return;
}
}
void CheckForClose()
{
double ma;
if(Volume[0]>1) return;
ma=iMA(null,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0);
int i;
for(i=0;ima & Close[1]ma)
{
if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,White))
Print("OrderClose error ",GetLastError());
}
break;
}
}
}
void OnTick()
{
if(Bars<100 | IsTradeAllowed()==false)
return;
if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();
else CheckForClose();
}
}
}
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Tadas Talaikis
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!