Is it possible for a custom indicator that when we check there is a buffer but when we use I custom, the buffer cannot be read? I mean is it possible some one build Custom Indicator but lock it so we cant use it as EA
The problem is I have an indicator in the form of an up and down arrow and I checked that there is a buffer at 0 and buffer 1 but when I call with icustom it doesn't work.
This is whats its look and this script i used:
Thanks
but when I call with icustom it doesn't work
Why do you think so? What result did you get?
"Doesn't work" is too vague a term that says nothing. Describe what you did, what result you expected and what result you got.- Agus Wahyu Pratomo: but when I call with icustom it doesn't work.
“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. (2004)
When asking about code
Be precise and informative about your problemDo you really expect an answer? There are no mind readers here and our crystal balls are cracked.
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem -
Your posted code is without context. Are those lines in OnTick? Always post all relevant code (using Code button) or attach the source file.
-
bool cond_buy = buy_Arrow !=EMPTY_VALUE;
Does the indicator use EMPTY_VALUE or some other (like zero)?Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
Code debugging - Developing programs - MetaEditor Help
Error Handling and Logging in MQL5 - MQL5 Articles (2015)
Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)
Okay this is the source code
I just wanna make ea when signal match from indicators, ea will sending message. But i think methode i use to read buffer is wrong. can you guys help me.
Alain Verleyen #:
How do you know it's buffer indexed 0 and 1 ?
I look by preesing Ctrl D when indi attached. Like picture above
//+------------------------------------------------------------------+ //| PanahALert.mq4 | //| Coded 2023, by Tomz Techno | //| https://www.youtube.com/channel/UC_-yKQG_F-0CahPMl4VKvWw | //+------------------------------------------------------------------+ #define _VERSION_ "1.0" #define _expertID "Arrow Confirm" //+------------------------------------------------------------------+ #property copyright _expertID+" | coded by TomzTechno" #property version _VERSION_ #property description "Telegram: @tomosie | Whatsapp: +6285777717118 \n" #property strict extern bool NotifHP = true;//Notifikasi HP extern bool NotifMail = true;//Notifikasi Email //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { string TF; if(Period()==1440) { TF = "D1"; } if(Period()==240) { TF = "H4"; } if(Period()==60) { TF = "H1"; } if(Period()==30) { TF = "M30"; } if(Period()==15) { TF = "M15"; } if(Period()==5) { TF = "M5"; } if(Period()==1) { TF = "M1"; } string symbol = Symbol(); string buyMessage = "BUY "+symbol+" TIMEFRAME "+TF+" GO"; string sellMessage = "SELL "+symbol+" TIMEFRAME "+TF+" GO"; string buyTest = "BUY"; string sellTest = "SELL"; double buy_Arrow = iCustom(NULL, 0,"Panah",0,1); double sell_Arrow = iCustom(NULL, 0,"Panah",1,1); double buy_Arrowprev = iCustom(NULL, 0,"Panah",0,1); double sell_Arrowprev = iCustom(NULL, 0,"Panah",1,1); // bool cond_buy = buy_Arrow > 0 && buy_Arrow < 99999999; // bool cond_sell = sell_Arrow > 0 && sell_Arrow < 99999999; bool cond_buy = buy_Arrow !=EMPTY_VALUE; bool cond_sell = sell_Arrow !=EMPTY_VALUE; if(cond_buy && IsNewCandle()) { // OrderSend(Symbol(),OP_BUY,0.01,Ask,5,Ask-0.00100,Ask+0.00100,0,0,0,Blue); Comment(buyMessage); Sleep(5000); if(NotifHP){SendNotification(buyMessage);} if(NotifMail){SendMail("PANAH ALERT UP",buyMessage);} } if(cond_sell && IsNewCandle()) { // OrderSend(Symbol(),OP_SELL,0.01,Bid,5,Bid+0.00100,Bid-0.00100,0,0,0,Red); Comment(sellMessage); Sleep(5000); if(NotifHP){SendNotification(sellMessage);} if(NotifMail){SendMail("PANAH ALERT DOWN",sellMessage);} } } //+------------------------------------------------------------------+ bool IsNewCandle() { static int BarsOnChart=0; if (Bars==BarsOnChart) return(false); BarsOnChart = Bars; return(true); }
Try to understand what exactly happens when your code is executed.
Check what value iCustom returns on a bar with an arrow (Print()/Alert()/...). Compare this value with the one you see in the data window for this bar. Do these values match?
Localize the problem instead of just saying my code doesn't do what I want
I wrote you a script for this
#property strict #property script_show_inputs #define INDICATOR_NAME "Panah" input int inpBarIdx = 1; // Bar index void OnStart() { showBuffersOn(inpBarIdx); } void showBuffersOn(int barIndex) { double value0, value1; if(!getBufferValue(value0, barIndex, 0) || !getBufferValue(value1, barIndex, 1)) return; Alert(StringFormat("Bar %s, buff#0 %s, buff#1 %s", TimeToString(Time[barIndex]), priceToString(value0), priceToString(value1))); } bool getBufferValue(double &value, int barIndex, int bufferIndex) { ResetLastError(); value = iCustom(Symbol(), PERIOD_CURRENT, INDICATOR_NAME, // Inputs ------ // (Default) // ------------- bufferIndex, barIndex); int err = GetLastError(); if(err == ERR_NO_ERROR) return(true); Alert(StringFormat("Failed to load \"MQL4/Indicators/" + INDICATOR_NAME + ".ex4\"! Error %i, value %s", err, priceToString(value))); return(false); } string priceToString(double price) { return(DoubleToString(price, Digits())); }
Thanks for the script.
The script is for checking the buffer and also the value right. With this the buffer is 0 and 1
I test it when arrow buffer 1 is shows up it will write a Comment. I am using logic if buffer 1 is not EMPTY_VALUE it will write comment
This is what i do but the Comment wont shows up. Sorry iam a beginner. What my mistake?
void OnTick() { double sell_Arrow = iCustom(NULL, 0,"Panah",1,1); bool cond_sell = sell_Arrow !=EMPTY_VALUE; if(cond_sell) { Comment("sellMessage"); } }
Also when i debug to see value buffer 0 and buffer 1 its value 0.0
is it possible maybe the indi is protected so cant be read from buffer?
here is i upload the indicator
Thanks for the script.
The script is for checking the buffer and also the value right. With this the buffer is 0 and 1
I test it when arrow buffer 1 is shows up it will write a Comment. I am using logic if buffer 1 is not EMPTY_VALUE it will write comment
This is what i do but the Comment wont shows up. Sorry iam a beginner. What my mistake?
Why are you comparing with EMPTY_VALUE? The 0.0 value you get where there is no arrow is not EMPTY_VALUE.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is it possible for a custom indicator that when we check there is a buffer but when we use I custom, the buffer cannot be read? I mean is it possible some one build Custom Indicator but lock it so we cant use it as EA
The problem is I have an indicator in the form of an up and down arrow and I checked that there is a buffer at 0 and buffer 1 but when I call with icustom it doesn't work.
This is whats its look and this script i used:
Thanks