# Pattern Forecast Calculations

Support Portal  »  Knowledgebase  »  Viewing Article

• 19/07/2021 2:18 PM

# Chart Patterns

## Emerging Patterns Arrow

• Let arrowX0 be the pattern_end_time of the pattern.
• Let arrowY0 be the close-value of candle at pattern_end_time.
• Let arrowX1 be the value of arrowX0 + (pricegraph length * 0.2).
• If direction > 0, then let arrowY1 be arrowY0 + (resistance_y0 - support_y0), otherwise let arrowY1 be arrowY0 - (resistance_y0 - support_y0).

Example sudo-code: Next we need to calculate where the arrow intersects on the resistance or support line:

• Let arrowGradient be (arrowY1 – arrowY0) / (arrowX1 – arrowX0).
• If direction > 0, then let lineGradient be (resistance_y1 - resistance_y0) / (resistance_x1 - resistance_x0), otherwise let lineGradient be (support_y1 - support_y0) / (support_x1 - support_x0).
• If direction > 0 then let linePoint be resistance_y1 + lineGradient * (pattern_end_time - resistance_x1), otherwise let linePoint be support_y1 + lineGradient * (pattern_end_time - support_x1).
• Let arrowXIntercept be 1 / (lineGradient - arrowGradient) * (linePoint - arrowY1) + pattern_end_time.
• Let arrowY1 be lineGradient * (arrowXIntercept – pattern_end_time) + linePoint.

Example sudo-code: The arrow is then drawn from (arrowX0,arrowY0) to (arrowXIntercept,arrowY1)

## Completed Patterns Arrow

• Let arrowX0 be pattern_end_time.
• Let arrowY0 be the close-value of the candle at pattern_end_time
• Let arrowX1 be arrowX0 + (pricegraph length * 0.1).
• If direction > 0 then let arrowY1 be the prediction_price_from, else let arrowY1 be the prediction_price_to

Example sudo-code: The arrow is then drawn from (arrowX0,arrowY0) to (arrowX1,arrowY1)

## Completed Patterns Prediction Area

• Let predictionTime be pattern_end_time + pattern_length.
• If the predictionTime is greater than the pricegraph length, then let predictionTime be pricegraph_length * 1.1.
• Draw rectangle as (pattern_end_time + 5 pixels, prediction_price_from, prediction_price_to, predictionTime) 

# Key Levels

## Emerging Patterns Arrow

• Let arrowX0 be the pattern_end_time of the pattern.
• Let arrowY0 be the close-value of candle at pattern_end_time.
• Let arrowX1 be the value of arrowX0 + (pricegraph length * 0.05).
• Let arrowY1 be the value of pattern_price
• The arrow is then drawn from (arrowX0,arrowY0) to (arrowX1,arrowY1)

## Completed Patterns Arrow

• Let arrowX0 be the pattern_end_time.
• Let arrowY0 be the close of candle at pattern_end_time.
• Let arrowX1 be arrowX0 + (pricegraph length * 0.1).
• If direction > 0 then let arrowY1 be prediction_price_from, else let arrowY1 be prediction_price_to.
• The arrow is then drawn from (arrowX0,arrowY0) to (arrowX1,arrowY1)

Example sudo-code: ## Completed Patterns Prediction Area

Let predictionTime be pattern_end_time + pattern_length.If the predictionTime is greater than the pricegraph length, then let predictionTime be pricegraph_length * 1.1.Draw rectangle as (pattern_end_time + 5 pixels, prediction_price_from, prediction_price_to, predictionTime) 

# Appendix A

## API Terminology

Pattern_end_time
The pattern end time can be found in all pattern results.
In the XML API it will appear as the following: In the json API it will appear as the following: Price Graph
For the purpose of displaying the pattern, the Price Graph comprises the candle list 20 candles before the start of the pattern, up to and including the candle at the end of the pattern.

Direction
The Direction can be found in all pattern results. A direction of 1 means the pattern is bullish, a value of -1 means the batter is bearish.
In the XML API it will appear as the following: In the json API it will appear as the following: Resistance_Y0
The Resistance_Y0 value can be found in all pattern results, but it is better to calculate the value based on the pricegraph data being used.
To calculate the value, extract the UNIX timestamp value of resistance_x0 from the API.
In the XML API it will appear as the following: In the json API it will appear as the following (the value will have to be converted to a UNIX timestamp): Next determine the high-value of the candle at resistance_x0, this will be used as resistance_y0.

Support_Y0
Apply point 1.4 to the support_Y0, only using the support-values instead.

Prediction_Price_From
The prediction_price_from value can be found in completed pattern results only.
In the XML API it will appear as the following: In the json API it will appear like this: Prediction_Price_To
In the XML API it will appear as the following: In the json API it will appear as the following: Pattern_Price
In the json API it will appear as the following: # Appendix B – Images

## Images 1 This represents the point resistance_x0, resistance_y0.This represents the point support_x0, support_y0.This is the pattern lengthThis is the pricegraph length at the time the pattern was identified.This represents the pattern_end_time time.This represents the calculated point arrowX0, arrowY0.This represents the calculated point arrowX1, arrowY1.This represents the calculated point arrowXIntercept, arrowY1.

## Images 2 This represents the pattern_end_time time.This represents the calculated point arrowX0, arrowY0.This represents the calculated point arrowX1, arrowY1.This is the pricegraph length at the time the pattern was identified.

## Images 3 This represents the point (pattern.pattern_end_time + 5 pixels, pattern.prediction_price_to)This represents the point (pricegraph_length * 1.1, pattern.prediction_price_from)

## Images 4 This represents the pattern_end_time time.This represents the calculated point arrowX0, arrowY0.This represents the calculated point arrowX1, arrowY1.This is the pricegraph length at the time the pattern was identified.

## Images 5 This represents the point (pattern.pattern_end_time + 5 pixels, pattern.prediction_price_to)This represents the point (pricegraph_length * 1.1, pattern.prediction_price_from)

## Images 6 This represents the pattern_end_time time.This represents the calculated point arrowX0, arrowY0.This represents the calculated point arrowX1, arrowY1.This is the pricegraph length at the time the pattern was identified.

 See Appendix A-1.1 for terminology
 See Appendix A-1.2 for terminology
 See Appendix A-1.3 for terminology
 See Appendix A-1.4 for terminology
 See Appendix A-1.5 for terminology
 See Appendix B - Image 1
 See Appendix A-1.6 for terminology
 See Appendix A-1.7 for terminology
 See Appendix B – Image 2
 See Appendix B – Image 3
 See Appendix A – 1.8 for terminology
 See Appendix B - Image 6
 See Appendix B – Image 4
 See Appendix B – Image 5
 Point arrowX1, arrowY1 may not represent actual values, but are shown for display purposes only.

Share via