Posted By: tuuguu777
Count cross - 07/14/17 10:44
How to count price crosses any line?
Posted By: BobbyT
Re: Count cross - 07/14/17 14:42
Take a look at crossUnder and crossOver functions
If you want to count them in the past you will also want Bar() too
cheers,
BobbyT
Posted By: tuuguu777
Re: Count cross - 07/15/17 03:04
thank you for your advise
Posted By: tuuguu777
Re: Count cross - 07/15/17 03:23
i think bar() function can't count that price crosses any line.
Posted By: BobbyT
Re: Count cross - 07/15/17 03:40
You're absolutely right. It counts bars. So use the value of Bar() to loop over bars in the past and count each time an event occurs.
Unless there is a special function for such a thing that's how I would do it.
Cheers,
BobbyT
EDIT: C, like many languages is case sensitive. Bar() != bar()
Posted By: tuuguu777
Re: Count cross - 07/15/17 03:50
is it possible to chat with you through any social chat app?
Posted By: BobbyT
Re: Count cross - 07/15/17 03:54
I'm not on any social netwonking sites. But if you post some code I'd be glad to try and help further.
Cheers,
BobbyT
Posted By: tuuguu777
Re: Count cross - 07/15/17 04:02
How to write code that price crosses first time upper bollinger band line. Actually there many crosses upper bollinger band line. I need the first cross.
Posted By: BobbyT
Re: Count cross - 07/15/17 04:23
It needs to be relative to some other event otherwise you will just get the first cross in the simulation period.
Cheers,
BobbyT
Posted By: tuuguu777
Re: Count cross - 07/15/17 04:29
Can you write code about it? I think it is easy for you.