# Trend function

Watch how to order a trading robot

#### Top developers

 Oleksandr Pupkov Shukurjon Beknazarov Hasanboy Beknazarov Hooshang Nosratpanah Aleksei Beliakov Arkadii Zagorulko Muzaffar Ergashaliev Cai Liang Fedor Arkhipov Hossein Nouri all developers
121
Customer 2016.11.14 09:30 20 - 30 USD   from 2 to 4 day(s)

# int Trend (int &candles, int &strenght)

The idea is to check if the upper timeframe trend agreed with the indicator on the current timeframe.

I need a function that returns 1 if the trend is positive, otherwise 0, moreover I need that the function can also write in the first parameter (candles) how many candles ago the trend started; in the second parameter, it has to write the strenght of the trend, to understand if is a strong trend and when the trend has started.

How to calculate the strength:Consider the % variation of currency value from the start of the trend.

Suppose that I received a signal in D1 that suggest me to go sell. Through this function I want to check if the trend of the upper timeframes, in this case W1 and MN 1, confirm me that going sell is ok, and also understand when the trend started and how much is its strength.

Thus the result should be the same as the image attached.

Files:
trend.JPG 163 kb
Job completed in 2 days. The portfolio of contains 48 finished jobs. This developer received 29 feedbacks with an average rate of 4.34.
Do you want to place a new order for Anand?
2016.12.10
: very very nice client :)

2016.11.14 09:40
Published 1 code in Library
 Jobs: 641 (59% personal) Arbitration: 70 (completed in favor of the developer 31%, canceled in favor of the customer 40%) Overdue: 178 (27%)

2016.11.14 14:18
 Jobs: 429 (54% personal) Arbitration: 38 (completed in favor of the developer 15%, canceled in favor of the customer 68%) Overdue: 149 (34%)

2016.11.14 09:34
 Jobs: 192 (26% personal) Arbitration: 16 (completed in favor of the developer 6%, canceled in favor of the customer 31%) Overdue: 53 (27%)

2016.11.15 11:46
 Jobs: 48 (35% personal) Arbitration: 19 (completed in favor of the developer 26%, canceled in favor of the customer 31%) Overdue: 22 (45%)

2016.11.14 10:15
 Jobs: 27 (18% personal) Arbitration: 7 (completed in favor of the developer 28%, canceled in favor of the customer 0%) Overdue: 9 (33%)