Hoping someone can convert the 4 Tradingview indicators to MT5 mql5 files please ?
Attached File(s)
I will code your pivot EAs for no charge 28 replies
I will code your scalping EAs for no charge 163 replies
Oanda MT4 - Indicators and EAs not showing 2 replies
EAs and indicators relating to moutaki... 22 replies
InterbankFX has loaded its MT4 platform with custom EAs, indicators and scripts 1 reply
Disliked{quote} With price levels added to each fib level. The code has a new array, FibLevels[], which contains a list of the same levels as before, but the user may customize as desired. {image} v1.01 attached {file}Ignored
DislikedHoping someone can convert the 4 Tradingview indicators to MT5 mql5 files please ? {file} {file} {file} {file} {image}Ignored
Dislikedhello,coders,BestTraderEv I want to ask you please could you please make this indicator MTF {file}Ignored
Dislikedplease kindly share if you have MTF candle 50% with button, i have checked the button page on forexstation i cant find suchIgnored
Disliked{quote} Master please kindly upgrade to have candle 50% if possible {file}Ignored
DislikedPlease my people is it possible to convert this valuable indicator to mt4 ? {file}Ignored
DislikedHello programmers and moderators, I would like to ask a small favor on this following indicator. Can we add a condition for the drawn rectangle, like if we draw the rectangle on the top we color it red, and if we draw the rectangle below we color it green. Just like on this image below but automatic. Thanks in advance and happy weekends. {image} {file}Ignored
Disliked{quote} Thanks BESTEV trouble is both are deader than yesterday they aint working no more i was even thinking they are eas but no they aint. Please if theres time can you help me out to see what could be wrong with them.Thanks {file} {file}Ignored
Disliked{quote} Master thank you so much for always desiring to help, its a great form of encouragement, wish you continuous good health please sorry to bring you back to this, help to check the half line is having issues when i change the color from the default it keeps printing the default color and the new color, if you load the indi before you change the colorIgnored
Disliked{quote} It changes colors properly. Switch the button to OFF before changing the color.Ignored
Disliked{quote} Thanks BESTEV trouble is both are deader than yesterday they aint working no more i was even thinking they are eas but no they aint. Please if theres time can you help me out to see what could be wrong with them.Thanks {file} {file}Ignored
Disliked{quote} its having this when you apply time frame plus, ook thank you i appreciate your effortit works well when i put off button delete object and on the button again {image}Ignored
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Include |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>
//+------------------------------------------------------------------+
//| Inputs |
//+------------------------------------------------------------------+
input group"===== General inputs ====="
input long InpMagicNumber = 12345; // magic number
input double InpLots = 0.01; // lot size
input int InpStoploss= 150; // stop loss in % of the range (0=off)
input int InpTakeProfit= 200; // take profit in % of the range(0=off)
input group"===== Range inputs ====="
input int InpRangeStart = 600; // range start time in minutes
input int InpRangeDuration = 120; // range duration in minutes
input int InpRangeClose = 1200; // range close time in minutes (-1=off)
enum BREAKOUT_MODE_ENUM {
ONE_SIGNAL, // one breakout per range
TWO_SIGNALS // high and low breakout
};
input BREAKOUT_MODE_ENUM InpBreakoutMode = ONE_SIGNAL; // breakout mode
input group"===== Day of the week filter====="
input bool InpMonday = true; // range on monday
input bool InpTuesday = true; // range on tuesday
input bool InpWednesday = true; // range on wednesday
input bool InpThursday = true; // range on thursday
input bool InpFriday = true; // range on friday
//+------------------------------------------------------------------+
//| Global Variables |
//+------------------------------------------------------------------+
struct RANGE_STRUCT{
datetime start_time; // start of the range
datetime end_time; // end of the range
datetime close_time; // close time
double high; // high of the range
double low; // low of the range
bool f_entry; // flag if we are inside the range
bool f_high_breakout; // flag if a high breakout occured
bool f_low_breakout; // flag if a low breakout occured
RANGE_STRUCT() : start_time (0) ,end_time(0) ,close_time(0) ,high(0) , low(DBL_MAX) ,f_entry(false) , f_high_breakout(false) ,f_low_breakout(false) {};
};
RANGE_STRUCT range;
MqlTick prevTick, lastTick;
CTrade trade;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit(){
// check user inputs
if(!CheckInputs()){return INIT_PARAMETERS_INCORRECT;}
// set magicnumber
trade.SetExpertMagicNumber(InpMagicNumber);
// Calculate new range if input change
if(_UninitReason==REASON_PARAMETERS && CountOpenPositions()==0){
CalculateRange();
}
// draw objects
DrawObjects();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason){
// delete objects
ObjectsDeleteAll(NULL,"range");
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick(){
// Get current tick
prevTick = lastTick;
SymbolInfoTick(_Symbol,lastTick);
// range calculation
if(lastTick.time >= range.start_time && lastTick.time < range.end_time){
//set flag
range.f_entry = true;
//new high
if(lastTick.ask > range.high){
range.high = lastTick.ask;
DrawObjects();
}
//new low
if(lastTick.bid < range.low){
range.low = lastTick.bid;
DrawObjects();
}
}
// close positions
if(InpRangeClose>=0 && lastTick.time >= range.close_time){
if(!ClosePositions()) {return;}
}
// calculate new range if ...
if(((InpRangeClose>=0 && lastTick.time>=range.close_time) // close time reached
|| (range.f_high_breakout && range.f_low_breakout) // both breakout flags are true
|| (range.end_time==0) // range not calculated yet
|| (range.end_time!=0 && lastTick.time>range.end_time && !range.f_entry)) // there was a range calculated but no thick inside
&& CountOpenPositions()==0){
CalculateRange();
}
// check for breakouts
CheckBreakouts();
}
// check user inputs
bool CheckInputs(){
if(InpMagicNumber <= 0) {
Alert("Magicnumber <= 0");
return false;
}
if(InpLots <= 0 || InpLots > 10) {
Alert("Lots <= 0 or > 10");
return false;
}
if(InpStoploss <= 0 || InpStoploss > 1000) {
Alert("Stop Loss <= 0 or > 1000");
return false;
}
if(InpTakeProfit <= 0 || InpTakeProfit > 1000) {
Alert("Take Profit <= 0 or > 1000");
return false;
}
if(InpRangeClose <0 && InpStoploss == 0) {
Alert("Close time and stop loss is off <= 0 or > 1000");
return false;
}
if(InpRangeStart < 0 || InpRangeStart >= 1440) {
Alert("Range start < 0 or >= 1440");
return false;
}
if(InpRangeDuration <= 0 || InpRangeDuration >= 1440) {
Alert("Range duration <= 0 or >= 1440");
return false;
}
if(InpRangeClose >= 1440 || (InpRangeStart+InpRangeDuration)%1440 == InpRangeClose) {
Alert("Close time >= 1440 or end time == close time");
return false;
}
if(InpMonday + InpTuesday + InpWednesday + InpThursday + InpFriday==0){
Alert("Range is prohibited on all days of the week");
return false;
}
return true;
}
// calculate a new range
void CalculateRange()
{
// reset range variables
range.start_time = 0;
range.end_time = 0;
range.close_time = 0;
range.high = 0.0;
range.low = DBL_MAX;
range.f_entry = false;
range.f_high_breakout = false;
range.f_low_breakout = false;
// calculate range start time
int time_cycle = 86400;
range.start_time = (lastTick.time - (lastTick.time % time_cycle)) + InpRangeStart*60;
for( int i=0; i<8; i++){
MqlDateTime tmp;
TimeToStruct(range.start_time,tmp);
int dow = tmp.day_of_week;
if(lastTick.time>=range.start_time || dow==6 || dow==0 || (dow==1 && !InpMonday)|| (dow==2 && !InpTuesday) || (dow==3 && !InpWednesday) || (dow==4 && !InpThursday) || (dow==5 && !InpFriday)){
range.start_time += time_cycle;
}
}
// calculate range end time
range.end_time = range.start_time + InpRangeDuration*60;
for(int i=0; i<2; i++){
MqlDateTime tmp;
TimeToStruct(range.end_time,tmp);
int dow = tmp.day_of_week;
if(dow==6 || dow==0){
range.end_time += time_cycle;
}
}
// calculate range close
if(InpRangeClose>=0){
range.close_time = (range.end_time - (range.end_time % time_cycle)) + InpRangeClose*60;
for( int i=0; i<3; i++){
MqlDateTime tmp;
TimeToStruct(range.close_time,tmp);
int dow = tmp.day_of_week;
if(range.close_time<=range.end_time || dow==6 || dow==0){
range.close_time += time_cycle;
}
}
}
// draw objects
DrawObjects();
}
// count all open positions
int CountOpenPositions(){
int counter = 0;
int total = PositionsTotal();
for(int i=total-1; i>0; i--){
ulong ticket = PositionGetTicket(i);
if(ticket<=0){Print("Failed to get position ticket"); return -1;}
if(!PositionSelectByTicket(ticket)){Print("Failed to select position by ticket"); return -1;}
ulong magicnumber;
if(!PositionGetInteger(POSITION_MAGIC,magicnumber)){Print("Failed to get position magicnumber"); return -1;}
if(InpMagicNumber==magicnumber){counter++;}
}
return counter;
}
// check for breakouts
void CheckBreakouts(){
// Check if we are after the range end
if(lastTick.time >= range.end_time && range.end_time>0 && range.f_entry){
// check for high breakout
if(!range.f_high_breakout && lastTick.ask >= range.high){
range.f_high_breakout = true;
if(InpBreakoutMode==ONE_SIGNAL){range.f_low_breakout = true;}
// calculate stop loss and take profit
double sl = InpStoploss == 0 ? 0 : NormalizeDouble(lastTick.bid - ((range.high-range.low) * InpStoploss *0.01),_Digits);
double tp = InpTakeProfit == 0 ? 0 : NormalizeDouble(lastTick.bid + ((range.high-range.low) * InpTakeProfit *0.01),_Digits);
// open buy position
trade.PositionOpen(_Symbol,ORDER_TYPE_BUY,InpLots,lastTick.ask,sl,tp,"Breakout EA");
}
// check for low breakout
if(!range.f_low_breakout && lastTick.bid <= range.low){
range.f_low_breakout = true;
if(InpBreakoutMode==ONE_SIGNAL){range.f_high_breakout = true;}
// calculate stop loss and take profit
double sl = InpStoploss == 0 ? 0 : NormalizeDouble(lastTick.ask + ((range.high-range.low) * InpStoploss *0.01),_Digits);
double tp = InpTakeProfit == 0 ? 0 : NormalizeDouble(lastTick.ask - ((range.high-range.low) * InpTakeProfit *0.01),_Digits);
// open sell position
trade.PositionOpen(_Symbol,ORDER_TYPE_SELL,InpLots,lastTick.bid,sl,tp,"Breakout EA");
}
}
}
// close all open positions
bool ClosePositions (){
int total = PositionsTotal();
for(int i=total-1; i>=0; i--){
if(total!=PositionsTotal()){total=PositionsTotal(); i=total; continue;}
ulong ticket = PositionGetTicket(i); // select position
if(ticket<=0){Print("Failed to get position ticket"); return false;}
if(!PositionSelectByTicket(ticket)){Print("Failed to select position by ticket"); return false;}
long magicnumber;
if(!PositionGetInteger(POSITION_MAGIC,magicnumber)){Print("Failed to get position magicnumber"); return false;}
if(magicnumber == InpMagicNumber){
trade.PositionClose(ticket);
if(trade.ResultRetcode()!=TRADE_RETCODE_DONE){
Print("Failed to close position. Result: "+(string)trade.ResultRetcode()+":"+trade.ResultRetcodeDescription());
return false;
}
}
}
return true;
}
// draw chart objects
void DrawObjects()
{
// start time
ObjectDelete(NULL, "range start");
if(range.start_time>0){
ObjectCreate(NULL,"range start",OBJ_VLINE,0,range.start_time,0);
ObjectSetString(NULL,"range start",OBJPROP_TOOLTIP,"start of the range\n"+TimeToString(range.start_time,TIME_DATE|TIME_MINUTES));
ObjectSetInteger(NULL,"range start",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range start",OBJPROP_WIDTH,2);
ObjectSetInteger(NULL,"range start",OBJPROP_BACK,true);
}
// end time
ObjectDelete(NULL, "range end");
if(range.end_time>0){
ObjectCreate(NULL,"range end",OBJ_VLINE,0,range.end_time,0);
ObjectSetString(NULL,"range end",OBJPROP_TOOLTIP,"end of the range\n"+TimeToString(range.end_time,TIME_DATE|TIME_MINUTES));
ObjectSetInteger(NULL,"range end",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range end",OBJPROP_WIDTH,2);
ObjectSetInteger(NULL,"range end",OBJPROP_BACK,true);
}
// close time
ObjectDelete(NULL, "range close");
if(range.close_time>0){
ObjectCreate(NULL,"range close",OBJ_VLINE,0,range.close_time,0);
ObjectSetString(NULL,"range close",OBJPROP_TOOLTIP,"close of the range\n"+TimeToString(range.close_time,TIME_DATE|TIME_MINUTES));
ObjectSetInteger(NULL,"range close",OBJPROP_COLOR,clrRed);
ObjectSetInteger(NULL,"range close",OBJPROP_WIDTH,2);
ObjectSetInteger(NULL,"range close",OBJPROP_BACK,true);
}
// high
ObjectsDeleteAll(NULL,"range high");
if(range.high>0){
ObjectCreate(NULL,"range high",OBJ_TREND,0,range.start_time, range.high,range.end_time, range.high);
ObjectSetString(NULL,"range high",OBJPROP_TOOLTIP,"high of the range\n"+DoubleToString(range.high,_Digits));
ObjectSetInteger(NULL,"range high",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range high",OBJPROP_WIDTH,2);
ObjectSetInteger(NULL,"range high",OBJPROP_BACK,true);
// second high
ObjectCreate(NULL,"range high ",OBJ_TREND,0,range.end_time, range.high,InpRangeClose>=0 ? range.close_time : INT_MAX,range.high);
ObjectSetString(NULL,"range high ",OBJPROP_TOOLTIP,"high of the range\n"+DoubleToString(range.high,_Digits));
ObjectSetInteger(NULL,"range high ",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range high ",OBJPROP_BACK,true);
ObjectSetInteger(NULL,"range high ",OBJPROP_STYLE,STYLE_DOT);
}
// low
ObjectsDeleteAll(NULL,"range low");
if(range.low<DBL_MAX){
ObjectCreate(NULL,"range low",OBJ_TREND,0,range.start_time, range.low,range.end_time, range.low);
ObjectSetString(NULL,"range low",OBJPROP_TOOLTIP,"low of the range\n"+DoubleToString(range.low,_Digits));
ObjectSetInteger(NULL,"range low",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range low",OBJPROP_WIDTH,2);
ObjectSetInteger(NULL,"range low",OBJPROP_BACK,true);
// second low
ObjectCreate(NULL,"range low ",OBJ_TREND,0,range.end_time, range.low,InpRangeClose>=0 ? range.close_time : INT_MAX,range.low);
ObjectSetString(NULL,"range low ",OBJPROP_TOOLTIP,"low of the range\n"+DoubleToString(range.low,_Digits));
ObjectSetInteger(NULL,"range low ",OBJPROP_COLOR,clrBlue);
ObjectSetInteger(NULL,"range low ",OBJPROP_BACK,true);
ObjectSetInteger(NULL,"range low ",OBJPROP_STYLE,STYLE_DOT);
}
// refresh chart
ChartRedraw();
}
//+------------------------------------------------------------------+ Disliked{quote} Georgebaker fixed them. https://www.forexfactory.com/thread/...3#post14953113 However, let me ask you a question: You have been around for quite a long time, correct? How difficult is it to learn just a few basic things and fix such basic syntax issues by yourself? Or are you really so dense and you prefer to come here for every dumbest problem which you encounter? Who taught you to be so unable to do anything by yourself? Do you think it is a virtue what you're doing?...Ignored