Solar System in 3D [Astro Tool w/ Zodiac]Hello Traders and Developers,
I am excited to announce my latest Open Source indicator. At the core, this is a demonstration of PineScript’s capabilities in Rendering 3D Animations, while at the same time being a practical tool for Financial Astrologists.
This 3D Engine dynamically renders all the major celestial bodies with their individual orbits, rotation speeds, polar inclinations and astrological aspects, all while maintaining accurate spatial relationships and perspective.
This is a Geocentric model of the solar system (viewed from the perspective of Earth), since that is what most Astrologists use. Thanks to the AstroLib Library created by @BarefootJoey, this model uses the real coordinates of cosmic bodies for every timestamp.
This script truly comes to life when using the “Bar Replay” mode in TradingView, as you can observe the relationships between planets and price action as time progresses, with the full animation capabilities as mentioned above.
In addition to what I have described, this indicator also displays the orbital trajectories for each cosmic body, and has labels for everything. I have also added the ability to hover on all the labels, and see a short description of what they imply in Astrology.
Optional Planetary Aspect Computation
This indicator supports all the Major Planetary Aspects, with an accuracy defined by the user (1° by default).
Conjunction: 0° Alignment. This draws a RED line starting from the center, and going through both planets.
Sextile: 60° Alignment. This draws three YELLOW lines, connecting the planets to each other and to the center.
Square: 90° Alignment. This draws three BLUE lines, connecting the planets to each other and to the center.
Trine: 120° Alignment. This draws three PURPLE lines, connecting the planets to each other and to the center.
Opposition: 180° Alignment. This draws a GREEN line starting from one planet, passing through the center and ending on the second planet.
The below image depicts a Top-Down view of the system, with the Moon in Opposition to Venus and with Mars in Square with Neptune .
Retrograde Computation
This indicator also displays when a planet enters Retrograde (Apparent Backward Motion) by making its orbital trajectory dashed and the planet name getting a red background.
The image below displays an example of Jupiter, Saturn, Neptune and Pluto in Retrograde Motion, from the camera perspective of a 65 degree inclination.
Optional Zodiac Computation (Tropical and Sidereal)
Zodiac represents the relatively stationary star formations that rest along the ecliptic plane, with planets transitioning from one to the next, each with a 30° separation (making 12 in total). I have implemented the option to switch between Tropical mode (where these stars were 2,000 years ago) and Sidereal (where these stars are today).
The image below displays the Zodiac labels with clear lines denoting where each planet falls into.
While this indicator is deployed in a separate pane, it is trivial to transfer it onto your price chart, just by clicking and dragging the graphics. After that, you can adjust the visuals by dragging the scale on the side, or optimizing model settings. You can also drag the model above or below the price, as shown in the following image:
Of course, there are a lot of options to customize this planetary model to your tastes and analytical needs. Aside from visual changes for the labels, colors or resolution you can also disable certain planets that don’t meet your needs as shown below:
Once can also infer the current lunar phases using the Aspects between the Sun and Moon. When the Moon is Opposite the Sun that is a Full Moon, while when they are Conjunct that is a New Moon (and sometimes Eclipse).
—---------------------------------------------------------------------------
I have made this indicator open source to help PineScript programmers understand how to approach 3D graphics rendering, enabling them to develop ever more capable scripts and continuously push the boundaries of what's possible on TradingView.
The code is well documented with comments and has a clear naming convention for functions and variables, to aid developers understand how everything operates.
For financial astrologists, this indicator offers a new way to visualize and correlate planetary movements, adding depth and ease to astrological market analysis.
Regards,
Hawk
3d
3D Engine OverlayThe Overlay 3D Engine is an advanced and innovative indicator designed to render 3D objects on a trading chart using Pine Script language. This tool enables users to visualize complex geometric shapes and structures on their charts, providing a unique perspective on market trends and data. It is recommended to use this indicator with a time frame of 1 week or greater.
The code defines various data structures, such as vectors, faces, meshes, locations, objects, and cameras, to represent the 3D objects and their position in the 3D space. It also provides a set of functions to manipulate these structures, such as scaling, rotating, and translating the objects, as well as calculating their perspective transformation based on a given camera.
The main function, "render," takes a list of 3D objects (the scene) and a camera as input, processes the scene, and then generates the corresponding 2D lines to be drawn on the chart. The true range of the asset's price is calculated using an Exponential Moving Average (EMA), which helps adjust the rendering based on the asset's volatility.
The perspective transformation function "perspective_transform" takes a mesh, a camera, an object's vertical offset, and the true range as input and computes the 2D coordinates for each vertex in the mesh. These coordinates are then used to create a list of polygons that represent the visible faces of the objects in the scene.
The "process_scene" function takes a list of 3D objects and a camera as input and applies the perspective transformation to each object in the scene, generating a list of 2D polygons that represent the visible faces of the objects.
Finally, the "render" function iterates through the list of 2D polygons and draws the corresponding lines on the chart, effectively rendering the 3D objects in a 2D projection on the trading chart. The rendering is done using Pine Script's built-in "line" function, which allows for scalable and efficient visualization of the objects.
One of the challenges faced while developing the Overlay 3D Engine indicator was ensuring that the 3D objects rendered on the chart would automatically scale correctly for different time frames and trading pairs. Various assets and time frames exhibit different price ranges and volatilities, which can make it difficult to create a one-size-fits-all solution for rendering the 3D objects in a visually appealing and easily interpretable manner.
To overcome this challenge, I implemented a dynamic scaling mechanism that leverages the true range of the asset's price and a calculated ratio. The true range is calculated using an Exponential Moving Average (EMA) of the difference between the high and low prices of the asset. This measure provides a smooth estimate of the asset's volatility, which is then used to adjust the scaling of the 3D objects rendered on the chart.
The ratio is calculated by dividing the asset's opening price by the true range, which is then divided by a constant factor (32 in this case). This ratio effectively normalizes the scaling of the 3D objects based on the asset's price and volatility, ensuring that the rendered objects appear correctly sized and positioned on the chart, regardless of the time frame or trading pair being analyzed.
By incorporating the true range and the calculated ratio into the rendering process, the Overlay 3D Engine indicator is able to automatically adjust the scaling of the 3D objects on the chart, providing a consistent and visually appealing representation of the objects across various time frames and trading pairs. This dynamic scaling mechanism enhances the overall utility and versatility of the indicator, making it a valuable tool for traders and analysts seeking a unique perspective on market trends.
In addition to the dynamic scaling mechanism mentioned earlier, the Overlay 3D Engine indicator also employs a sophisticated perspective transformation to render the 3D objects on the chart. Perspective transformation is an essential aspect of 3D graphics, as it provides the necessary conversion from 3D coordinates to 2D coordinates, allowing the 3D objects to be displayed on a 2D chart.
The perspective transformation process in the Overlay 3D Engine indicator begins by taking the 3D mesh data of the objects and transforming their vertices based on the position, orientation, and field of view of a virtual camera. The camera's field of view (FOV) is adjusted using a tangent function, which ensures that the rendered objects appear with the correct perspective, regardless of the chart's aspect ratio.
Once the vertices of the 3D objects have been transformed, the perspective-transformed 2D coordinates are then used to create polygons that can be rendered on the chart. These polygons represent the visible faces of the 3D objects and are drawn using lines that connect the transformed vertices.
The incorporation of perspective transformation in the Overlay 3D Engine indicator ensures that the 3D objects are rendered with a realistic appearance, providing a visually engaging and informative representation of the market trends. This technique, combined with the dynamic scaling mechanism, makes the Overlay 3D Engine indicator a powerful and innovative tool for traders and analysts seeking to visualize and interpret market data in a unique and insightful manner.
In summary, the Overlay 3D Engine indicator offers a novel way to interpret and visualize market data, enhancing the overall trading experience by providing a unique perspective on market trends.
3D EngineHello everyone,
I am excited to share with you the first 3D engine in Pine Script! This is a remarkable achievement that will enable traders to explore the possibilities of 3D objects in their technical analysis.
To use this engine, you will need to use a higher time frame (1W or greater) to load the 3D objects in time. The code is straightforward and easy to use, with various input options to customize the object's position, rotation, and scale. You can select between two default 3D objects, Pin or Ball, by changing the 'list' input string.
The 3D engine is based on the vector and mesh data structures, and it includes several utility functions to perform operations such as rotation, translation, and scaling on these structures. It also includes functions to calculate perspective transformation for projecting 3D objects onto a 2D surface, which is the essential step in rendering the object in a 2D chart.
The 'process_scene' function is the main function that converts the 3D object data into 2D polygon data, which can be rendered on the chart. This function uses the 'process_object' function, which applies the object's transformation (position, rotation, and scale) and returns a scaled and rotated mesh that is ready for projection.
At the end of the code, there is a camera object that defines the camera's position, target, and field of view. You can customize this camera object to change the perspective of the rendered object.
To make your own 3D object, you can use the included Python program to convert an OBJ file into the format used by the engine. This program converts the OBJ file into a list of vector4 objects, which can be copy-pasted into the 'pin_vertex_list' array or a similar array. Please note that this process requires some knowledge of Python and the OBJ file format.
Overall, this is a fantastic achievement that opens up new possibilities for technical analysis in Pine Script. I encourage you to try it out and see what you can create with it.
In this code, there are several functions and data structures used to represent and manipulate 3D objects in a simple 3D engine. I will explain each function in detail below:
radians(degree): Converts an angle in degrees to radians.
quat_identity(): Returns a quaternion representing the identity rotation.
quat_from_axis_angle(axis, angle): Creates a quaternion from an axis of rotation and an angle.
quat_multiply(q1, q2): Multiplies two quaternions, q1 and q2, and returns the result.
quat_conjugate(q): Returns the conjugate of a quaternion, q.
quat_rotate(q, v): Rotates a 3D vector, v, by a quaternion, q, and returns the result.
rotate_vector_by_quaternion(v, q): Rotates a 3D vector, v, by a quaternion, q, and returns the result.
scale_vector(vector, constant): Scales a 3D vector by a constant and returns the result.
scale_mesh(mesh_obj, constant): Scales a mesh by a constant and returns the new mesh.
rotate_mesh(mesh_obj, axis, angle): Rotates a mesh around a specified axis by a given angle and returns the new mesh.
quat_translate(src, offset): Translates a 3D vector, src, by an offset and returns the result.
translate_mesh(mesh_obj, offset): Translates a mesh by an offset and returns the new mesh.
perspective_transform(msh, cam): Transforms a 3D mesh into a 2D mesh using a camera.
process_object(obj, cam): Processes a 3D object with a camera and returns a 2D mesh.
size(scene): Calculates the total number of vertices in a scene.
make_poly(scene): Converts a scene of 2D meshes into an array of polygons.
process_scene(scn, cam): Processes an entire scene of 3D objects with a camera and returns an array of polygons.
These functions work together to create a simple 3D engine that can manipulate, transform, and render 3D objects as 2D polygons. The main part of the script defines the camera, vertices, and faces for a pin object, and then uses the functions to process and render the object.
Note that some types are also defined in the code, including vector2, vector3, vector4, face, mesh, mesh2d, location, object, poly4, polyg, and camera. These types represent various mathematical structures and entities used in 3D graphics, such as vectors, faces, meshes, and cameras.
Here is an explanation of the inputs for all the functions in the given code:
radians(degree):
degree: Angle in degrees to be converted to radians.
quat_from_axis_angle(axis, angle):
axis: A vector3 object representing the axis of rotation.
angle: The angle in radians to rotate about the axis.
quat_multiply(q1, q2):
q1, q2: Two quaternion objects to be multiplied.
quat_conjugate(q):
q: A quaternion object whose conjugate is to be calculated.
quat_rotate(q, v):
q: The quaternion representing the rotation.
v: The vector3 object to be rotated.
rotate_vector_by_quaternion(v, q):
v: The vector3 object to be rotated.
q: The quaternion representing the rotation.
scale_vector(vector, constant):
vector: A vector4 object to be scaled.
constant: The scaling factor.
scale_mesh(mesh_obj, constant):
mesh_obj: A mesh object to be scaled.
constant: The scaling factor.
rotate_mesh(mesh_obj, axis, angle):
mesh_obj: A mesh object to be rotated.
axis: A vector3 object representing the axis of rotation.
angle: The angle in radians to rotate the mesh.
quat_translate(src, offset):
src: A vector4 object representing the source position.
offset: A vector3 object representing the translation offset.
translate_mesh(mesh_obj, offset):
mesh_obj: A mesh object to be translated.
offset: A vector3 object representing the translation offset.
perspective_transform(msh, cam):
msh: A mesh object to be transformed.
cam: A camera object used for the transformation.
process_object(obj, cam):
obj: An object containing a mesh and its location.
cam: A camera object used for processing the object.
make_poly(scene):
scene: An array of mesh2d objects to generate polygons from.
process_scene(scn, cam):
scn: An array of objects containing meshes and their locations.
cam: A camera object used for processing the scene.
Note that some of these functions are utility functions or internal functions, and their inputs are derived from other functions or user inputs.
I will make a library eventually.
PSv5 3D Array/Matrix Super Hack"In a world of ever pervasive and universal deceit, telling a simple truth is considered a revolutionary act."
INTRO:
First, how about a little bit of philosophic poetry with another dimension applied to it?
The "matrix of control" is everywhere...
It is all around us, even now in the very place you reside. You can see it when you look at your digitized window outwards into the world, or when you turn on regularly scheduled television "programs" to watch news narratives and movies that subliminally influence your thoughts, feelings, and emotions. You have felt it every time you have clocked into dead end job workplaces... when you unknowingly worshiped on the conformancy alter to cultish ideologies... and when you pay your taxes to a godvernment that is poisoning you softly and quietly by injecting your mind and body with (psyOps + toxicCompounds). It is a fictitiously generated world view that has been pulled over your eyes to blindfold, censor, and mentally prostrate you from spiritually hearing the real truth.
What TRUTH you must wonder? That you are cognitively enslaved, like everyone else. You were born into mental bondage, born into an illusory societal prison complex that you are entirely incapable of smelling, tasting, or touching. Its a contrived monetary prison enterprise for your mind and eternal soul, built by pretending politicians, corporate CONartists, and NonGoverning parasitic Organizations deploying any means of infiltration and deception by using every tactic unimaginable. You are slowly being convinced into becoming a genetically altered cyborg by acclimation, socially engineered and chipped to eventually no longer be 100% human.
Unfortunately no one can be told eloquently enough in words what the matrix of control truly is. You have to experience it and witness it for yourself. This is your chance to program a future paradigm that doesn't yet exist. After visiting here, there is absolutely no turning back. You can continually take the blue pill BIGpharmacide wants you to repeatedly intake. The story ends if you continually sleep walk through a 2D hologram life, believing whatever you wish to believe until you cease to exist. OR, you can take the red pill challenge, explore "question every single thing" wonderland, program your arse off with 3D capabilities, ultimately ascertaining a new mathematical empyrean. Only then can you fully awaken to discover how deep the rabbit hole state of affairs transpire worldwide with a genuine open mind.
Remember, all I'm offering is a mathematical truth, nothing more...
PURPOSE:
With that being said above, it is now time for advanced developers to start creating their own matrix constructs in 3D, in Pine, just as the universe is created spatially. For those of you who instantly know what this script's potential is easily capable of, you already know what you have to do with it. While this is simplistically just a 3D array for either integers or floats, additional companion functions can in the future be constructed by other members to provide a more complete matrix/array library for millions of folks on TV. I do encourage the most courageous of mathemagicians on TV to do so. I have been employing very large 2D/3D array structures for quite some time, and their utility seems to be of great benefit. Discovering that for myself, I fully realized that Pine is incomplete and must be provided with this agility to process complex datasets that traders WILL use in the future. Mark my words!
CONCEPTION:
While I have long realized and theorized this code for a great duration of time, I was finally able to turn it into a Pine reality with the assistance and training of an "artificially intuitive" program while probing its aptitude. Even though it knows virtually nothing about Pine Script 4.0 or 5.0 syntax, functions, and behavior, I was able to conjure code into an identity similar to what you see now within a few minutes. Close enough for me! Many manual edits later for pine compliance, and I had it in chart, presto!
While most people consider the service to be an "AI", it didn't pass my Pine Turing test. I did have to repeatedly correct it, suffered through numerous apologies from it, was forced to use specifically tailored words, and also rationally debate AND argued with it. It is a handy helper but beware of generating Pine code from it, trust me on this one. However... this artificially intuitive service is currently available in its infancy as version 3. Version 4 most likely will have more diversity to enhance my algorithmic expertise of Pine wizardry. I do have to thank E.M. and his developers for an eye opening experience, or NONE of this code below would be available as you now witness it today.
LIMITATIONS:
As of this initial release, Pine only supports 100,000 array elements maximum. For example, when using this code, a 50x50x40 element configuration will exceed this limit, but 50x50x39 will work. You will always have to keep that in mind during development. Running that size of an array structure on every single bar will most likely time out within 20-40 seconds. This is not the most efficient method compared to a real native 3D array in action. Ehlers adepts, this might not be 100% of what you require to "move forward". You can try, but head room with a low ceiling currently will be challenging to walk in for now, even with extremely optimized Pine code.
A few common functions are provided, but this can be extended extensively later if you choose to undertake that endeavor. Use the code as is and/or however you deem necessary. Any TV member is granted absolute freedom to do what they wish as they please. I ultimately wish to eventually see a fully equipped library version for both matrix3D AND array3D created by collaborative efforts that will probably require many Pine poets testing collectively. This is just a bare bones prototype until that day arrives. Considerably more computational server power will be required also. Anyways, I hope you shall find this code somewhat useful.
Notice: Unfortunately, I will not provide any integration support into members projects at all. I have my own projects that require too much of my time already.
POTENTIAL APPLICATIONS:
The creation of very large coefficient 3D caches/buffers specifically at bar_index==0 can dramatically increase runtime agility for thousands of bars onwards. Generating 1000s of values once and just accessing those generated values is much faster. Also, when running dozens of algorithms simultaneously, a record of performance statistics can be kept, self-analyzed, and visually presented to the developer/user. And, everything else under the sun can be created beyond a developers wildest dreams...
EPILOGUE:
Free your mind!!! And unleash weapons of mass financial creation upon the earth for all to utilize via the "Power of Pine". Flying monkeys and minions are waging economic sabotage upon humanity, decimating markets and exchanges. You can always see it your market charts when things go horribly wrong. This is going to be an astronomical technical challenge to continually navigate very choppy financial markets that are increasingly becoming more and more unstable and volatile. Ordinary one plot algorithms simply are not enough anymore. Statistics and analysis sits above everything imagined. This includes banking, godvernment, corporations, REAL science, technology, health, medicine, transportation, energy, food, etc... We have a unique perspective of the world that most people will never get to see, depending on where you look. With an ever increasingly complex world in constant dynamic flux, novel ways to process data intricately MUST emerge into existence in order to tackle phenomenal tasks required in the future. Achieving data analysis in 3D forms is just one lonely step of many more to come.
At this time the WesternEconomicFraudsters and the WorldHealthOrders are attempting to destroy/reset the world's financial status in order to rain in chaos upon most nations, causing asset devaluation and hyper-inflation. Every form of deception, infiltration, and theft is occurring with a result of destroyed wealth in preparation to consolidate it. Open discussions, available to the public, by world leaders/moguls are fantasizing about new dystopian system as a one size fits all nations solution of digitalID combined with programmableDemonicCurrencies to usher in a new form of obedient servitude to a unipolar digitized hegemony of monetary vampires. If they do succeed with economic conquest, as they have publicly stated, people will be converted into human cattle, herded within smart cities, you will own nothing, eat bugs for breakfast/lunch/dinner, live without heat during severe winter conditions, and be happy. They clearly haven't done the math, as they are far outnumbered by a ratio of 1 to millions. Sith Lords do not own planet Earth! The new world disorder of human exploitation will FAIL. History, my "greatest teacher" for decades reminds us over, and over, and over again, and what are time series for anyways? They are for an intense mathematical analysis of prior historical values/conditions in relation to today's values/conditions... I imagine one day we will be able to ask an all-seeing AI, "WHO IS TO BLAME AND WHY AND WHEN?" comprised of 300 pages in great detail with images, charts, and statistics.
What are the true costs of malignant lies? I will tell you... 64bit numbers are NOT even capable of calculating the extreme cost of pernicious lies and deceit. That's how gigantic this monstrous globalization problem has become and how awful the "matrix of control" truly is now. ALL nations need a monumental revision of its CODE OF ETHICS, and that's definitely a multi-dimensional problem that needs solved sooner than later. If it was up to me, economies and technology would be developed so extensively to eliminate scarcity and increase the standard of living so high, that the notion of war and conflict would be considered irrelevant and extremely appalling to the future generations of humanity, our grandchildren born and unborn. The future will not be owned and operated by geriatric robber barons destined to expire quickly. The future will most likely be intensely "guided" by intelligent open source algorithms that youthful generations will inherit as their birth right.
P.S. Don't give me that politco-my-diction crap speech below in comments. If they weren't meddling with economics mucking up 100% of our chart results in 100% of tickers, I wouldn't have any cause to analyze any effects generated by them, nor provide this script's code. I am performing my analytical homework, but have you? Do you you know WHY international affairs are in dire jeopardy? Without why, the "Power of Pine" would have never existed as it specifically does today. I'm giving away much of my mental power generously to TV members so you are specifically empowered beyond most mathematical agilities commonly existing. I'm just a messenger of profound ideas. Loving and loathing of words is ALWAYS in the eye of beholders, and that's why the freedom of speech is enshrined as #1 in the constitutional code of the USA. Without it, this entire site might not have been allowed to exist from its founder's inceptions.
Moving Averages 3DHello All,
This is an experimental work to show 10 moving averages in 3D by using linefill.new() feature of the Pine language.
You can set moving average type as Simple (SMA) or Exponential (EMA)
You can set "Starting Length" and set the "Step" to calculate other lengths. For example; if "Starting Length" is 10 and "step" is 5 then the lengths are 10, 15, 20, 25...
You can set the colors as Red, Green, Blue for each direction. And you can change the width. you can see the examples below
In following example Green and Blue used:
In following example Blue and Red is used and Width is set as 5:
Enjoy!
Trend Following MAs 3DHello All,
This is Moving Averages Trend Following 3D indicator. The idea is based on direction of MAs and relation between 20 moving averages (5 to 100 period).
Option to show different type of MAs: EMA, SMA, RMA, WMA, VWMA.
As I haved tested it looks succesful at calculating trend direction and trend strength.
For a better look I tried to make it 3D, it looks good I think, waiting comments ;)
Some screenshots:
By using RMA type:
When it gets tiny it means there is no trend:
An example for down trend:
ENJOY!
[RS]Plot in 3DEXPERIMENTAL:
plotting price,time,volume + additional price shift from moving average.
ote 3d v0This was supposed to be an automatic ICT OTE (Optimal Trade Entry) Fib level placement on a 3-day scale, but this did not turn out anywhere near close to how I envisioned it working.
Probably with some more development and applied math for the fib levels, I can get this to work even with breached 3D levels, but currently it's an exercise in frustration.
Wave Channel 3D Wave Channel 3D
Built by Ricardo idea from JR & Aloakdutt from indieTrades Jan. 2010
This indicator is very easy to build. We utilize Moving Averages with a set multiplier and an offset. Specially we try to use Fibonacci sequence series numbers (1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...) as time space and multiplier (default 89, 8). Also included is Donchian Channel to locate strong trends and possible future support - resistance.
Examples of support/resistance on chart.
Dominant Price Trends
Future Support Resistance
Comparing Fibonacci Series Time Space - Multiplier
When Comparing make note of confluence support/resistance showing up with Fibonacci Series
Example uses DC
When Comparing make note of confluence support/resistance showing up with Fibonacci Series
Example without DC / Smooth MA
[RS]Dolchian/Bollinger Hybrid V0EXPERIMENTAL: trend and range analysis using dolchian and bollinger channels methodology merged into one, possibly it can be used to extract 3d depth of market :p