Jump to content


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

Toggle shoutbox The Traders Chat Open the Shoutbox in a popup

@  traderpusa : (12 December 2018 - 07:49 PM) Good morning
@  raommurin : (12 December 2018 - 04:12 PM) TMA no repaint
@  binaryop : (12 December 2018 - 02:18 PM) [email protected] sure ..inbox please
@  trade2winz : (12 December 2018 - 01:10 PM) Ha guys I have a forex strategy that ive been using but i lack discipline at time i need a partner that knows market profile
@  Samgaz : (12 December 2018 - 01:05 PM) Hello grou`p
@  ShenR : (12 December 2018 - 10:20 AM) volatility.mq4
@  cuscus11 : (12 December 2018 - 06:34 AM) if you want the adjustment
@  cuscus11 : (12 December 2018 - 06:34 AM) you could send me an email at [email protected]
@  cuscus11 : (12 December 2018 - 06:32 AM) i had to make adjustment to the binary comodo indicator ,its more accurate for binary options and forex/cfd trading
@  cuscus11 : (12 December 2018 - 06:31 AM) hello friends
@  canan : (12 December 2018 - 04:47 AM) konkis BO tester
@  traderpusa : (11 December 2018 - 06:05 PM) good morning
@  karkare2016 : (11 December 2018 - 02:12 PM) how are you
@  karkare2016 : (11 December 2018 - 02:12 PM) hi
@  Cladi48 : (11 December 2018 - 02:02 PM) Market soo trendy today
@  Jeka_new : (11 December 2018 - 01:15 PM) binary bot
@  Bigindoda : (11 December 2018 - 07:21 AM) liverpool :wub:
@  traderpusa : (10 December 2018 - 07:28 PM) history repeats itself.
@  traderpusa : (10 December 2018 - 06:43 PM) good morning
@  jesusrcc : (10 December 2018 - 08:36 AM) no brexit vote tomorrow https://www.theguard...ningful-vote-eu

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   10 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
  • LocationI m no longer here...so dont expect any answers, indicators, EAs, goldnuggets....:-)

Posted 27 December 2016 - 05:15 AM

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


codingwizzard.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   85 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
  • 235 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
  • 235 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
  • 13 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.