Auftrag beendet
Ausführungszeit 4 Stunden
Spezifikation
Good afternoon,
I have a simple MT4 indicator I would like translated to MQL5, keeping code structure, functions, constants and comments.
The indicator has four buffers: two lines and two arrows, draws rectangles and labels, implements alerts and ignores unclosed bar.
The indicator is barely 200 lines with heavy comments. See below.
//+------------------------------------------------------------------+ //| ExampleIndicator.mq4 //+------------------------------------------------------------------+ #property copyright "Flaab" #property link "None" //--- constants #define OLabel "ExLabel" #define ShortName "Example Indi" #define Shift 1 //---- indicator settings #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 DodgerBlue #property indicator_color2 Red #property indicator_color3 DodgerBlue #property indicator_color4 Red #property indicator_width1 3 #property indicator_width2 3 #property indicator_width3 2 #property indicator_width4 2 //---- indicator parameters extern string Settins = "------- Settings"; extern int TradePeriod = 20; extern int TimingPeriod = 3; extern color BullBox = LightBlue; extern color BearBox = LightSalmon; extern color BullLabel = DodgerBlue; extern color BearLabel = Red; extern string Alerts_ex = "------- Alerts"; extern string AlertCaption = "My Alert Name"; extern bool DisplayAlerts = true; extern bool EmailAlerts = false; extern bool PushAlerts = false; extern bool SoundAlerts = false; extern string SoundFile = "alert.wav"; //---- indicator buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double TrendDirection[]; //---- internal static int AlertTriggered; static datetime TimeStamp; static int AlertCount = 1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { // 4 Visible buffers + invisible one IndicatorBuffers(5); // Drawing settings SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,233); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,234); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); // Buffers SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexBuffer(3,ExtMapBuffer4); SetIndexBuffer(4,TrendDirection); // Invisible buffer. // Delete old objects DeleteObjects(); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ void DeleteObjects() { int obj_total=ObjectsTotal(); for(int i = obj_total - 1; i >= 0; i--) { string label = ObjectName(i); if(StringFind(label, OLabel)==-1) continue; ObjectDelete(label); } } int deinit() { DeleteObjects(); return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { // More vars here too... int start = 1; int limit; int counted_bars = IndicatorCounted(); // check for possible errors if(counted_bars < 0) return(-1); // Only check these limit = Bars - 1 - counted_bars; // Comment account info CommentInfo(); // Iterate from past to present // Ignore unclosed bar! for(int i = limit; i >= start; i--) { // Highest and Lowest of the last N bars double rhigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1)); double rlow = iLow(Symbol(),Period(),iLowest(Symbol(), Period(), MODE_LOW, TradePeriod, i+1)); double bhigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TimingPeriod,i+1)); double blow = iLow(Symbol(),Period(),iLowest(Symbol(), Period(), MODE_LOW, TimingPeriod, i+1)); // Do not allow retracements if(ExtMapBuffer1[i+1] != EMPTY_VALUE && rlow < ExtMapBuffer1[i+1]) rlow = ExtMapBuffer1[i+1]; if(ExtMapBuffer2[i+1] != EMPTY_VALUE && rhigh > ExtMapBuffer2[i+1]) rhigh = ExtMapBuffer2[i+1]; // Preserve trend direction TrendDirection[i] = TrendDirection[i+1]; // Reset buffers ExtMapBuffer1[i] = EMPTY_VALUE; ExtMapBuffer2[i] = EMPTY_VALUE; ExtMapBuffer3[i] = EMPTY_VALUE; ExtMapBuffer4[i] = EMPTY_VALUE; // No Alert by default AlertTriggered = EMPTY_VALUE; //-- Check for uptrend if(Close[i] > rhigh && TrendDirection[i+1] != OP_BUY) { AlertTriggered = OP_BUY; TrendDirection[i] = OP_BUY; ExtMapBuffer3[i] = rlow; //-- Check for downtrend } else if(Close[i] < rlow && TrendDirection[i+1] != OP_SELL) { AlertTriggered = OP_SELL; TrendDirection[i] = OP_SELL; ExtMapBuffer4[i] = rhigh; } // Draw lines if(TrendDirection[i] == OP_BUY) ExtMapBuffer1[i] = rlow; if(TrendDirection[i] == OP_SELL) ExtMapBuffer2[i] = rhigh; // Breakouts / Rectangles if(TrendDirection[i] == OP_BUY && Close[i] > bhigh && bhigh <= High[i+TimingPeriod]) { DrawRectangle(i, TimingPeriod+1, BullBox); DrawLabel("Buy", i + MathCeil(TimingPeriod/2), OP_BUY, BullLabel); } else if(TrendDirection[i] == OP_SELL && Close[i] < blow && blow >= Low[i+TimingPeriod]){ DrawRectangle(i, TimingPeriod+1, BearBox); DrawLabel("Sell", i + MathCeil(TimingPeriod/2), OP_SELL, BearLabel); } } // Alerts if(TimeStamp != Time[0]) { if(AlertTriggered == OP_BUY && AlertCount == 0) { if(DisplayAlerts == true) { Alert(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"] BUY"); } if(PushAlerts == true) { SendNotification(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"] BUY"); } if(EmailAlerts == true) { SendMail(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"]", Symbol() +": BUY"); } if(SoundAlerts == true) { PlaySound(SoundFile); } } else if (AlertTriggered == OP_SELL && AlertCount == 0) { if(DisplayAlerts == true) { Alert(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"] SELL"); } if(PushAlerts == true) { SendNotification(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"] SELL"); } if(EmailAlerts == true) { SendMail(ShortName +" ("+ AlertCaption +") ["+ Symbol() +"]", Symbol() +": SELL"); } if(SoundAlerts == true) { PlaySound(SoundFile); } } TimeStamp = Time[0]; AlertCount = 0; } return(0); } /** * Comments account info */ void CommentInfo() { double balance = AccountBalance(); double spread = MarketInfo(Symbol(), MODE_SPREAD); Comment("Account Balance: "+ DoubleToStr(balance, 2) +"\n"+ "Spread: "+ DoubleToStr(spread, 0) +" pts\n"+ "Quote: "+ DoubleToStr(Bid, Digits) +"/"+ DoubleToStr(Ask, Digits)); } /** * Draws a rectangle * @param int shift Relative bar for rectangle * @param int pshift Past bar for rectangle * @param int vcolor Color of rectangle */ void DrawRectangle(int shift, int pshift, color vcolor) { // Times for rectangle datetime x1 = Time[shift]; datetime x2 = Time[shift+pshift-1]; // Label string label = OLabel +"Rect-"+ pshift + x2; // Prices for rectangle double rhigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, pshift, shift)); double rlow = iLow(Symbol(),Period(),iLowest(Symbol(), Period(), MODE_LOW, pshift, shift)); // Draw ObjectCreate(label, OBJ_RECTANGLE, 0, x1, rlow, x2, rhigh); ObjectSet(label, OBJPROP_COLOR, vcolor); ObjectSet(label, OBJPROP_BACK, true); } /** * Draws a label * @param string text Text to display * @param int shift Bar to display the text * @param int vType OP_BUY is above the bar, OP_SELL below the bar * @param color vcolor Color of the text */ void DrawLabel(string text, int shift, int vType, color vcolor) { // Time datetime x1 = Time[shift]; datetime x2 = Time[shift+1]; double vPrice; // Color if(vType == OP_BUY) { vPrice = Low[shift]; } else { vPrice = High[shift] + iATR(Symbol(), 0, 30, Shift)*0.90; } // Label string label = OLabel +"-"+ text +"-"+ x2; ObjectCreate(label, OBJ_TEXT, 0, x2, vPrice); ObjectSetText(label, text, 8, "Tahoma", vcolor); ObjectSet(label, OBJPROP_BACK, true); }
Bewerbungen
1
Bewertung
Projekte
24
38%
Schlichtung
4
50%
/
0%
Frist nicht eingehalten
9
38%
Frei
2
Bewertung
Projekte
621
38%
Schlichtung
39
23%
/
64%
Frist nicht eingehalten
93
15%
Frei
Ähnliche Aufträge
Minor Expert Advisor Edits
50+ USD
I need an EA edited to make TWO main changes to conditions for how it enters trades. The EA code is written with clean code and is well commented. Will provide more info on changes in a doc in the chat
BUY AND SELL
30+ USD
Create an Expert Advisor that collaborates between these indicators ETR, MEv2 and STLv3 with these features 1. SL and TP 2. TIME FILTER 3. ETR, MEv2 and STLv3 PARAMETERS BUY ENTRY STEP 1. FIRST candle OPEN above Symphonie Trend Line STEP 2. Check Symphonie Extreme must indicate color BLUE STEP 3. Check Symphonie Emotion must indicate color BLUE STEP 4. Open trade with money management STEP 5. Trade open MUST BE 1
Hello, I have a protected Ninja trader Order Flow indicator and I was wondering if you can reverse engineer it to replicate the functionality. H ere are the specifications and indicator: https://docs.google.com/document/d/1KyYwQ7iTL2KWGhnZzxS1gObccu9LPMrGuMc9Mdk_3KY/edit?usp=sharing
I have an EA that need some changes including integrating the indicator code directly into the Expert Advisor. I will give the detailed doc once we settle on the candidate for the job . Please bid if you can work with the stated amount. Thanks
Hello, Need to convert Tradingview Indicator to MQL4 indicator. or if you have this one converted already, let me buy a copy please. If we're good, then will definitely buy it and ask to convert into EA on new order. Supertrend by KivancOzbilgic
Fix bug or modify an existing Trading view indicator to display correct. The indicator is working but not displaying/plotting all the information i want. So i want it adjusted to plot all the info
Here's a brief requirement you can use: **Description:** I am seeking an experienced MQL5 developer to create a (EA). The EA should include features for placing pending orders (Buy Stop and Sell Stop) based on market spread, managing trades effectively at the opening of new candlesticks, and implementing take profit and stop loss strategies. Additionally, I would like the option to adjust parameters based on market
I have an EA which i need to do below modifications. Variable Inputs to be added Order Type : Market , Pending Trade Type : Buy, Sell , Buy & Sell Pending Pips Step : ( Pips Value can be negative or positive to decide on what type of Pending Order ) // If trade type Buy is selected Close Type : Close All ( Bulk Close Option in MT5 ) , Close Individually Close Option : %of Equity , %of Balance , Amount $ , %of No
Add multiplier to grid recovery system. For example: Grid Trade 2-3 Spacing; 1.0 Multiplier Grid Trade 4-6 Spacing; 2.0 Multiplier Grid Trade 7+ Spacing; 1.6 Multiplier Need quick turn around. Need it done ASAP
Objects reader PIN
70 - 100 USD
Hi I have an indicator that create objects in the chart and using those following some rules the new indicator will create external global variables with value = 0 ( NONE ), = 1 ( BUY ) or = 2 ( SELL ). The global variable will use PIN external integer number . PINS are by now global variables (GV) whose name indicates the pair name and the PIN belonging and their value indicates it direction/action. PINS GV names
Projektdetails
Budget
10 - 100 USD
Für die Entwickler
9
- 90
USD
Ausführungsfristen
bis 5 Tag(e)