Generation

generate functionSat, 06 May 2023

This script should draw a rectangle, titled TOOLS, which should appear in the window of Japanese candlestick charts and that in the configuration allows you to select its color, position in front of or behind Japanese candlesticks, additionally you can modify its size and minimize to a small rectangle that only shows the title of the rectangle. This rectangle must contain buttons that will allow drawing in a simple, fast and easy way all the following concepts: 1. Button named "Suply" Offer zone: when pressing the button a pale green rectangle must be inserted that is placed behind the Japanese lines, this rectangle can be moved and resized. Additionally, the rectangle must be inserted in the last demand zone that has the active time frame. 2. Button named "Demmand" Demand zone: pressing the button should insert a pale red rectangle that is placed behind the Japanese lines, this rectangle can be moved and resized. 3. Button named "OB_Bull": pressing the button should insert a pale green rectangle that is placed behind the Japanese lines, containing three segmented gray lines, one at the bottom, another in the middle, and the last at the top of the rectangle, this rectangle can be moved, resized, and the lines must always be attached to the rectangle. Additionally, the rectangle must be inserted in the last zone of bullish order blocks that has the active time frame. 4. Button named "OB_Bear": pressing the button should insert a pale red rectangle to be placed behind the Japanese lines, containing three segmented gray lines one at the bottom, one in the middle, and the last at the top of the rectangle, this rectangle can be moved, resized, and the lines must always be attached to the rectangle. Additionally, the rectangle must be inserted in the last bearish order block zone that has the active time frame. 5. Button named "FVG" Fair Value gap: pressing the button should insert a pale yellow rectangle that goes behind the Japanese lines, this rectangle can be moved and resized. Additionally, the rectangle must be inserted in the last imbalance that has the active time frame, when pressing it a second time it will have to appear in the second imbalance counting from the current time to the past and so on. 6. Button named "EQH" Equal High: when pressing the button, a segmented line of black color of thickness 3 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size, but it must always be horizontal . Additionally, the line must be inserted at the highest price of the last trading session that has the active time frame, when pressing it a second time it will have to appear at the second highest price of the penultimate trading session counting from the current time to past and so on. 7. Button named "EQL" Equal Low: when pressing the button, a segmented line of black color of thickness 3 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size, but it must always be horizontal . Additionally, the line must be inserted at the lowest price of the last trading session that has the active time frame, when pressing it a second time it will have to appear at the second lowest price of the penultimate trading session counting from the current time to past and so on. 8. Button name "BOS_H" Brake of Structure HIGH: it is the meaning of breaking structure to summarize the bullish bos is when the current price exceeds the price of the last fractal higher. When pressing the button, a segmented line of GREEN color of thickness 3 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size, but it must always be horizontal. Additionally, the line must be inserted in the LAST bullish bos. 9. Button named "BOS_L" Brake of Structure LOW: it is the meaning of breaking structure to summarize the bearish bos is when the current price is less than the price of the last lower fractal. When pressing the button, a segmented line of RED color of thickness 3 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size, but it must always be horizontal. Additionally, the line must be inserted in the LAST BEARISH bos. 10. Button named "Trend", Tendency: when pressing the button, a segmented line of white color of thickness 2 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size. Additionally, the line must be inserted in the last trend that has the active time frame. 11. Button named "Line": when pressing the button, a continuous line of WHITE color of thickness 3 must be inserted that is placed on the Japanese lines, this line can be moved and changed in size, but it must always be horizontal. 12. Clear: it must allow deleting all the lines and rectangles made by pressing the previous buttons, in the timeframe that is being watched, without deleting objects that have not been inserted with the buttons of this code. In the indicator configuration, you can give the options to modify the following: In the rectangles: 1. To show or not to show 2. Choice of Color 3. Choice of Line Type 4. Choice of Thickness 5. Description text (it will be the name that will appear on the object) 6. Alignment of the description 7. In which temporalities to show it (All, current and lower, current and higher) 8. Description to show (Do not show, only show time frame, only show price, only show concept, show time frame + price, show concept + price, show time frame plus concept, show time frame + concept + price) In the lines: 1. To show or not to show 2. Choice of Color 3. Choice of Line Type 4. Choice of Thickness 5. Description text (it will be the name that will appear on the object) 6. Alignment of the description 7. In which temporalities to show it (All, current and lower, current and higher) 8. Description to show (Do not show, only show time frame, only show price, only show concept, show time frame + price, show concept + price, show time frame plus concept, show time frame + concept + price)

def drawRect(x1, y1, x2, y2, linecolor=color.white, linestyle=line.style_solid, linewidth=1, fillcolor=None): if x1 > x2: x1, x2 = x2, x1 if y1 > y2: y1, y2 = y2, y1 if fillcolor: chart.drawFilledBox(x1, y1, x2, y2, fillcolor) chart.drawBox(x1, y1, x2, y2, linecolor, linestyle, linewidth) drawRect(1, 2, 3, 4)

Questions about programming?Chat with your personal AI assistant