I need a little help about writing a simple code for one of my custom indicators

 

Hello everybody,

I need to write a simple code to let my indicator identify what timeframe is used on the chart where it's opened.

I mean, i need my indicator to be able to recognize what timeframe is used, when I drag and drop it on a chart or even when i change TF.

Can you please help me write this simple code?


I need it because when i use my indicator on H1 it has to use some values, and if i change TF i need it to change few values automatically. 


Thanks a lot

 
Chris70:

4x "I need" within 4 sentences sounds like a job for a freelancer

Probably because of my bad english. I made the whole indicator by myself, i only dont know how to write this simple line of code..
 
Tommaso Nardini:
Probably because of my bad english. I made the whole indicator by myself, i only dont know how to write this simple line of code..
_Period
 

Sorry, the english is perfect as far as I can say as a non-native speaker myself. I was just questioning the attitude - and I was probably a little quick with my reaction, which is why I had already deleted it the second after.

Anyways.. Maybe my reaction was unfair, it's just that this happens all the time on this forum... all this "I need" and "HELP !!!" etc. without putting the least effort into showing what has already been tried.

Why don't you just show the code and I'm sure it will be an easy fix and we're all good.

[edit: --> Alain, quick as always ;-)]
 
Alain Verleyen:

Thanks a lot, I was trying to use Period() function but it did not work. Then i tried with the _Period as you adviced me and finally it worked, so thanks a lot!

 
Chris70:

Sorry, the english is perfect as far as I can say as a non-native speaker myself. I was just questioning the attitude - and I was probably a little quick with my reaction, which is why I had already deleted it the second after.

Anyways.. Maybe my reaction was unfair, it's just that this happens all the time on this forum... all this "I need" and "HELP !!!" etc. without putting the least effort into showing what has already been tried.

Why don't you just show the code and I'm sure it will be an easy fix and we're all good.

[edit: --> Alain, quick as always ;-)]

Chris no problem at all!

I am not a seasonal coder and I am still learning. I usually do everything by myself and I just search on the net when I stuck somewhere and cannot find a solution.

This time was probably because I was using the wrong function. 

I tried to use Period() function and it did not work, but then I tried with _Period and finally it did work as expected. 

Here you can see what I did:

 

It is very easy, and I thought so, that's why I was asking for a little help from the community, because I was pretty sure it was such a simple thing to do but I was just missing which variable to use..


Anyway, thanks a lot, next time i will write a post i will consider your comment and you advices to be more clear and more polite!


I am following your posting about Neural Network with lots of interests. Actually I was trying to collaborate with an experienced programmer on an A.I. trading software as I am an experienced trader since over 14 years and giving him my advices, but then he had to stop and we end unfortunalty our collaboration. It would be a pleasure if you would need any help from my side!


cheers! 

Reason: