# Requests & Ideas - page 268

163384

pooh123:

Happy New Year !

Here's a new request (I didn't give you much break recently). Can you please create an indicator that works this way

For a bar-

1) If a tick price is higher than the previous tick price, we call it an Up Tick. If a tick price is lower than the previous tick price, we call it a Down Tick. We call the price difference between any two adjacent Up Ticks “ Up Tick Difference”; We call the price difference between any two adjacent Down Ticks “Down Tick Difference”.

Sum up the absolute value of all Up Tick Differences for the bar and we call it Up Tick Difference Total; sum up the absolute value of all Down Tick Differences for the bar and we call it Down Tick Difference Total.

2) Divide the Up Tick Difference Total by number of Up Ticks of the bar ; divide the Down Tick Difference Total by number of Down Ticks of the bar. The two values we get from the divisions become the outputs of the indicator.

pooh

pooh

That can be done only for ticks when the indicator starts to work on some time frame /symbol ( runtime data - there is no historical ticks data and it can not be reconstructed for the past). Is that what you had in mind?

231

pooh That can be done only for ticks when the indicator starts to work on some time frame /symbol ( runtime data - there is no historical ticks data and it can not be reconstructed for the past). Is that what you had in mind?

Yes, I expected that.

pooh

231

pooh123:

Happy New Year !

Here's a new request (I didn't give you much break recently). Can you please create an indicator that works this way

For a bar-

1) If a tick price is higher than the previous tick price, we call it an Up Tick. If a tick price is lower than the previous tick price, we call it a Down Tick. We call the price difference between any two adjacent Up Ticks “ Up Tick Difference”; We call the price difference between any two adjacent Down Ticks “Down Tick Difference”.

Sum up the absolute value of all Up Tick Differences for the bar and we call it Up Tick Difference Total; sum up the absolute value of all Down Tick Differences for the bar and we call it Down Tick Difference Total.

2) Divide the Up Tick Difference Total by number of Up Ticks of the bar ; divide the Down Tick Difference Total by number of Down Ticks of the bar. The two values we get from the divisions become the outputs of the indicator.

pooh

Sorry that I need change the logic for "Up Tick Difference" and "Down Tick Difference". This is the logic I need it to be:

Up Tick Difference= price of an Up Tick - price of the previous tick

Down Tick Difference= price of a Down Tick - price of the previous tick

The rest remain unchanged.

pooh

163384

pooh123:

Sorry that I need change the logic for "Up Tick Difference" and "Down Tick Difference". This is the logic I need it to be:

Up Tick Difference= price of an Up Tick - price of the previous tick

Down Tick Difference= price of a Down Tick - price of the previous tick

The rest remain unchanged.

pooh

pooh

Try this one out (I tested it in visual back test and it seems to be working OK). One option added : SameSide. If it is set to true the values are drawn on the same side of 0 (like the upper values on the example picture), otherwise it will show values like on the lower example. Also an option to use total ticks per bar or just the number of ticks that were up or down added

_____________________

PS: I guess that the results are going to look quite different at run-time than in this visual back test (this results are just showing how visual back test works, not how the real data looks like)

Files:
948

Does this indicator requires adjustment for use in an EA?

Regards,

Paul

Files:
163384

tamaraofx:

Does this indicator requires adjustment for use in an EA?

Regards,

Paul

Paul

I am not sure that I understand the question

If the question is if the indicator needs some code changes so that it can be used from an EA, the answer is : no, no code changes needed for that indicator. It can be used from an EA perfectly well as it is now

948

Paul

I am not sure that I understand the question

If the question is if the indicator needs some code changes so that it can be used from an EA, the answer is : no, no code changes needed for that indicator. It can be used from an EA perfectly well as it is now

Thanks, mladen. I used that indicator in an Ea but the EA runs so slow. That's why I asked. And because I've seen some of your indicators been revised for use in an ea.

Thanks again.

Paul

163384

tamaraofx:
Thanks, mladen. I used that indicator in an Ea but the EA runs so slow. That's why I asked. And because I've seen some of your indicators been revised for use in an ea.

Thanks again.

Paul

Paul

Do not forget the first parameter (the TimeFrame). Use "" in iCustom() call as a first parameter and it should work OK (if you omitted that parameter it will run very slow and will return wrong results)

163384

tamaraofx:
Thanks, mladen. I used that indicator in an Ea but the EA runs so slow. That's why I asked. And because I've seen some of your indicators been revised for use in an ea.

Thanks again.

Paul

Paul

This is the correct way to call that indicator :

double currentTrend = iCustom(NULL,timeFrame,IndicatorFileName,"",SmoothPeriod,SmoothPhase,2,barToTest);

If currentTrend is == 1, trend is up, if it is -1 trend is down

948

Paul

This is the correct way to call that indicator :

double currentTrend = iCustom(NULL,timeFrame,IndicatorFileName,"",SmoothPeriod,SmoothPhase,2,barToTest);
If currentTrend is == 1, trend is up, if it is -1 trend is down