How to use Indicator count and how to turn key event into code in MQL4

How to use Indicator count and how to turn key event into code in MQL4

Manage alerts

Loading saved threads...

RobertFT · External communityPost link
External question — Stack Overflow Stack Exchange Author: RobertFT Original post: https://stackoverflow.com/questions/62783672 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm just learning to code and have few questions. Can someone tell me please how to do this thing; 1- How to prevent my custom indicator being duplicated on the chart? If it's already on the chart and I will drop it on to the chart again, I want it to detect the first one and abort launching the second one. something like this: but working :) int OnInit() { int indicators_total = ChartIndicatorsTotal(0,0); for(int i = 0; ndicators_total > i; i++) { if(ChartIndicatorName(0,0,i)==IndicatorName) return(INIT_FAILED); (AND THEN EXIT) } } 2 - How do I detect if there is more than one indicator with the same name on the chart? 3 - How to write an "if" statement to do something if indicator "x" is not present (=0) on the chart? Something like this: but working :) if(IndicatorName==0) { Print("INDI ",IndicatorName, " NOT DETECTED"); } 4 - And is there a way to put keyboard event (F11 - full screen) into code? To make my custom indicator be able to detect when full screen is on just like with the "chart scale" ChartGetInteger(0,CHART_SCALEFIX); ?
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: RobertFT Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/62783672 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I'm just learning to code and have few questions. Can someone tell me please how to do this thing; 1- How to prevent my custom indicator being duplicated on the chart? If it's already on the chart and I will drop it on to the chart again, I want it to detect the first one and abort launching the second one. something like this: but working :) int OnInit() { int indicators_total = ChartIndicatorsTotal(0,0); for(int i = 0; ndicators_total > i; i++) { if(ChartIndicatorName(0,0,i)==IndicatorName) return(INIT_FAILED); (AND THEN EXIT) } } 2 - How do I detect if there is more than one indicator with the same name on the chart? 3 - How to write an "if" statement to do something if indicator "x" is not present (=0) on the chart? Something like this: but working :) if(IndicatorName==0) { Print("INDI ",IndicatorName, " NOT DETECTED"); } 4 - And is there a way to put keyboard event (F11 - full screen) into code? To make my custom indicator be able to detect when full screen is on just like with the "chart scale" ChartGetInteger(0,CHART_SCALEFIX); ?

Cancel quote

Checking account access…