Jump to content


Next High Impact Market News Event:
Retrieving events...

Toggle shoutbox The Traders Chat Open the Shoutbox in a popup

If someone starts flaming you PM me with a screenshot of the incident and I will ban them if its legit. Do not flame them back, it makes our work as admins harder figuring out who started it. So if you flame them back, you may get banned too.
@  CRAIGL : (18 September 2018 - 02:39 AM) good afternoon
@  traderpusa : (17 September 2018 - 08:46 PM) good morning
@  Tripack : (17 September 2018 - 11:12 AM) Well, I will see how it goes, I really love the chat interaction lately lol :P take care !
@  Tripack : (17 September 2018 - 10:35 AM) Right, maybe risky but longeurusd again
@  Tripack : (17 September 2018 - 09:26 AM) Taking a break, good luck !
@  Tripack : (17 September 2018 - 09:25 AM) Carefully quick shorting but less weight
@  Tripack : (17 September 2018 - 09:12 AM) & out
@  Tripack : (17 September 2018 - 07:58 AM) Looking good :)
@  Tripack : (17 September 2018 - 06:36 AM) eurusd
@  Tripack : (17 September 2018 - 06:35 AM) Was initially short biased for today but not anymore, thinking 1.170 has a chance ?
@  Tripack : (17 September 2018 - 06:31 AM) Probably more stocks/indices impacting but still...
@  Tripack : (17 September 2018 - 06:30 AM) careful in general today/tomorrow as us vs china news may come out
@  Tripack : (17 September 2018 - 06:29 AM) Eurusd becoming harder to trade
@  dawid9840 : (17 September 2018 - 04:24 AM) fib pivot
@  Tripack : (17 September 2018 - 01:11 AM) Morning
@  traderpusa : (16 September 2018 - 07:32 PM) Good morning
@  ahmetesk : (16 September 2018 - 11:07 AM) @sgfn01 Maxim? yes that crazy gambler with martingale :P
@  hongquan102 : (16 September 2018 - 05:36 AM) billykay indicator
@  sgfn01 : (15 September 2018 - 05:27 PM) Hello people! a long time ago had a Russian trader Makisin he was always among the first placed in the world ranking iq option, what will happen to him, I never saw his name in the ranking.
@  Bigindoda : (14 September 2018 - 03:27 PM) friday night gave me nice profit https://charts.mql5....-point-of-3.png

Photo

How to add simple counter on an indicator

counter indicator mt4

  • Please log in to reply
15 replies to this topic

#1 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 27 December 2016 - 04:37 AM

Hi All,

 

I want to insert in my custom indicator a counter like this one:

 

Attached File  counter.png   5.7KB   9 downloads

 

If some special condition is satisfied then it shuold update the win counter and the percent, otherwise it should only update the OTM.

 

I would like this counter appear as soon as i put my indicator on the chart and that it updates itself for each satisfied conditions.

 

I created something like that but it doesn't work at all.

 

What should I put under init(), deinit(),start() and out of them?

 

thanks



#2 jinji

jinji

    Member

  • Members
  • PipPip
  • 242 posts

Posted 27 December 2016 - 04:59 AM

I think you must rewrite the whole code.

 

But this is my opinion.



#3 reteid

reteid

    Member

  • Members
  • PipPipPip
  • 1,063 posts
  • LocationHey....letz code the impossible..and what do we do in the afternoon?

Posted 27 December 2016 - 05:15 AM

Write it on the start cause this event is triggered when a new tick comes! ;)


vCFPmVfN.png


#4 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 27 December 2016 - 05:24 AM

I put something outside the start() function.

 

In the start() function i just call (before the return) "AddLabelsCounter(X)".

 

Do you think it's wrong?

void AddLabelsCounter(int limitj)
{   
   string name = StringConcatenate(UniqueID,"_Labels");
   
   for(int i=limitj; i>0; i--)
   {
      if(*special condition verified)
      {
         count++;
         win++;
      }
      else
      {
         count++;
         lost++;
      }
      
      double perc_temp=win/count*100;
      perc=NormalizeDouble(perc_temp,2);
      
   string counter=StringConcatenate("Total: ",count," Win: ",win," Lost: ",lost," Perc: ",perc,"%");
   
   ObjectCreate(chart_id,name,OBJ_LABEL,0,0,0);
   ObjectSetText(name,counter,LabelFontWidth,NULL,LabelColor);
   ObjectSet(name,OBJPROP_XDISTANCE,LabelXDistance);
   ObjectSet(name,OBJPROP_YDISTANCE,LabelYDistance);
   ObjectSet(name,OBJPROP_CORNER,LabelCorner);   
   }
}


#5 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 27 December 2016 - 10:44 AM

Write it on the start cause this event is triggered when a new tick comes! ;)

 

Sorry reteid, could have a look at the source?

 

Attached File  Test Counter.mq4   17.45KB   81 downloads



#6 neurus

neurus

    Member

  • Members
  • PipPip
  • 38 posts

Posted 03 January 2017 - 12:35 PM

You have a 0 division, change the line 247 to:

 

if(count>0)double perc_temp=win/count*100;


  • zephyrus likes this

#7 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 10 January 2017 - 04:57 AM

You have a 0 division, change the line 247 to:

 

if(count>0)double perc_temp=win/count*100;

 

Thanks neurus, it works well!



#8 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 13 January 2017 - 05:36 AM

I still have some problem. When I load a template with an indicator which contains the counter, I see a double counter overload. How can I fix this problem?



#9 nnld218

nnld218

    Member

  • Members
  • PipPip
  • 234 posts

Posted 17 January 2017 - 05:01 AM

@zephyrus

 

how to add counter on buy, sell arrow ?  :mellow:

 

example: i have indicator with buy/sell arrow with 2 Buffer

buy arrow = Buffer "1"

sell arrow = Buffer "2"



#10 zephyrus

zephyrus

    Member

  • Members
  • PipPip
  • 83 posts

Posted 17 January 2017 - 09:08 AM

@zephyrus

 

how to add counter on buy, sell arrow ?  :mellow:

 

example: i have indicator with buy/sell arrow with 2 Buffer

buy arrow = Buffer "1"

sell arrow = Buffer "2"

 

Download the Test_Counter indicator some post above and apply the suggestion of neurus. It's not so hard



#11 nnld218

nnld218

    Member

  • Members
  • PipPip
  • 234 posts

Posted 17 January 2017 - 09:28 AM

Download the Test_Counter indicator some post above and apply the suggestion of neurus. It's not so hard

 
Can you add it to this simple indicator for me ?
Your indicator are quite confusing. If you add it to my indicator , i can understand clearly  :D

Attached Files


  • freestyle20 likes this

#12 freestyle20

freestyle20

    Member

  • Members
  • PipPip
  • 122 posts
  • LocationCzech

Posted 08 February 2017 - 01:45 PM

Download the Test_Counter indicator some post above and apply the suggestion of neurus. It's not so hard

 

Please, can you do manual for any indicator?



#13 lorenita

lorenita

    Member

  • Members
  • PipPip
  • 17 posts

Posted 21 February 2017 - 10:30 AM

just to justify the counter ( it says high % because it reads the winning or loosing signal of the candle it's on, and not the next candle witch is the actual loosing or winning candle ) look at the stratagie tester from Jan to Feb , not to far slow it down at Jan 4 14:15 to 14:25 and you'll see. SO the code is wrong ..



#14 lorenita

lorenita

    Member

  • Members
  • PipPip
  • 17 posts

Posted 22 February 2017 - 01:16 AM

can someone fix it so it counts the next candle after the arrow???


  • freestyle20 likes this

#15 siraj

siraj

    Member

  • Members
  • PipPip
  • 289 posts
  • LocationAfrica

Posted 15 April 2017 - 04:16 AM

Hello Friends ,
 
I try to use the same logic to create the counter as been described above, but when I load the indicator it doesnt shows, can u please look into the code and see where I have done mistake.
 
Kind Regards

Attached Files



#16 Predator

Predator

    Member

  • Members
  • PipPip
  • 12 posts

Posted 02 November 2017 - 11:33 PM

Sorry reteid, could have a look at the source?

 

attachicon.gifTest Counter.mq4

Not hearing any Alerts...







Also tagged with one or more of these keywords: counter, indicator, mt4

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


USA REGULATION NOTICE: There are many binary options companies which are not regulated within the United States. Most of these offshore companies are not supervised, connected or affiliated with any of the regulatory agencies such as the Commodity Futures Trading Commission (CFTC), National Futures Association (NFA), Securities and Exchange Commission (SEC) or the Financial Industry Regulatory Authority (FINRA).

It is our STRONG opinion that you do not operate with any unregulated brokerage firm as they may steal or try to scam you out of every dime you have. Please take notice that any unregulated trading activity by U.S. Citizens should be considered unlawful.

Risk Disclosure: Binary Options Edge does not accept any liability for loss or damage as a result of reliance on the information contained within this website; this includes education material, price quotes and charts, and analysis. Please be aware of the risks associated with trading the financial markets; never invest more money than you can risk losing. The risks involved in trading binary options are high and may not be suitable for all investors. Binary Options Edge doesn't retain responsibility for any trading losses you might face as a result of using the data hosted on this site. The data and quotes contained in this website are not provided by exchanges but rather by market makers. So prices may be different from exchange prices and may not be accurate to real time trading prices. They are supplied as a guide to trading rather than for trading purposes.