Python Forum
An important question is how to create a zigzag in price data?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An important question is how to create a zigzag in price data?
#1
Example "argrelextrema" lists:
""liste_1 = list(argrelextrema(price_high.values, np.greater, order=1)[0])""
""liste_2 = list(argrelextrema(price_low.values, np.less, order=1)[0])""

list_1 = [2, 11, 13, 21, 27, 33, 35, 40, 43, 45, 47, 53, 55, 57, 59, 62, 69, 74, 76, 81, 84, 86, 89, 98]
list_2 = [4, 6, 8, 14, 17, 20, 25, 32, 41, 44, 49, 54, 56, 58, 61, 63, 72, 75, 78, 81, 83, 85, 90, 95]
total_list = []

These lists are prepared with the "argrelextrema" of the high and low values of a price (parity). Now, to be able to zigzag, each element in the total_list must have an element from the opposite list to the left and right. (up and down) But the problem is, for example list_2 has between "4 and 6" and "6 and 8" have no elements from list_1. In the method I tried, there are no 4 and 6 in the total list, but there is 8 (because there is an element from list_1 between 8 and 14) Thus, points up and down are determined. But maybe instead of 8 it should have been 4 or 6 in total_list. (There is an original price list, maybe 4th and 6th prices are lower than 8th.)

In short, I want to draw a correct zigzag.
Of course, later I will check if the difference between the prices represented by each element of this list is greater than 0.0025.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Create X Number of Variables and Assign Data RockBlok 8 926 Nov-14-2023, 08:46 AM
Last Post: perfringo
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,098 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Python 3.11 data import question love0715 2 806 Mar-05-2023, 06:50 PM
Last Post: snippsat
  Create simple live plot of stock data dram 2 2,912 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
  Create a function for writing to SQL data to csv mg24 4 1,150 Oct-01-2022, 04:30 AM
Last Post: mg24
  Finding the price based on industry and number of transactions chandramouliarun 0 909 Jul-26-2022, 07:36 PM
Last Post: chandramouliarun
  class - calculate total price of copies 3lnyn0 1 1,553 Dec-12-2021, 11:43 PM
Last Post: BashBedlam
Exclamation Invalid syntax error(Predict Ethereum Price) lulu43366 2 3,163 Sep-24-2021, 01:24 PM
Last Post: lulu43366
  Property price calculation oli_action 4 3,142 Jul-15-2020, 04:27 PM
Last Post: sridhar
  zigzag example shabux 10 5,388 Jul-11-2020, 11:15 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020