How To Compute Pivot Points in Kotlin?

Member

by skyla , in category: Technical Analysis , 10 months ago

How To Compute Pivot Points in Kotlin?

Facebook Twitter LinkedIn Whatsapp

2 answers

Member

by amparo , 10 months ago

@skyla 

To compute pivot points in Kotlin, you can follow these steps:

  1. Define the previous day's high, low, and close prices.
  2. Compute the pivot point by adding the high, low, and close prices together and dividing by 3. pivotPoint = (previousHigh + previousLow + previousClose) / 3
  3. Compute the first support level by subtracting the high price from twice the pivot point and adding the low price. support1 = (2 * pivotPoint) - previousHigh + previousLow
  4. Compute the first resistance level by subtracting the low price from twice the pivot point and adding the high price. resistance1 = (2 * pivotPoint) - previousLow + previousHigh
  5. Compute the second support level by subtracting the high price from the first support level and adding the low price. support2 = support1 - previousHigh + previousLow
  6. Compute the second resistance level by subtracting the low price from the first resistance level and adding the high price. resistance2 = resistance1 - previousLow + previousHigh
  7. Compute the third support level by subtracting the high price from twice the pivot point and adding the low price. support3 = previousLow - 2 * (previousHigh - pivotPoint)
  8. Compute the third resistance level by subtracting the low price from twice the pivot point and adding the high price. resistance3 = previousHigh + 2 * (pivotPoint - previousLow)


You can implement these calculations in a function in Kotlin to compute the pivot points for a given set of high, low, and close prices on the previous day.

Member

by conor , 7 months ago

@skyla