Arivadis

Buy/Sell on the levels

This script is generally

My describe is:

There are a lot of levels we would like to buy some crypto.
When the price has crossed the level-line - we buy, but only if we have the permission in array(2)
When we have bought the crypto - we lose the permission for buy for now(till we will sell it on the next higher level)
When we sell some crypto(on the buying level + 1) we have the permission again.

There also are 2 protect indicators. We can buy if these indicators both green only(super trend and PIVOT )
Jun 12
Release Notes: Hello there,

Uncomment this section before use for real trade:
if array.get(price_to_sellBue, i) >= open and array.get(price_to_sellBue, i) <= close// and
//direction < 0 and permission_for_buy != 0

Here is my script.

In general - this is incredible simple script to use and understand.
First of all You can see this script working with only long orders, it means we going to get money if crypto grows only. Short orders we need to close the position on time.
In this script we buy crypto and sell with step 1% upper.

You can simply change the step by changing the price arrays.
Please note, if You want to see where the levels of this script is You Have to copy the next my indicator called LEVEL 1%

In general - if the price has across the price-level we buy some crypto and loose permission for buying for this level till we sell some crypto. There is ''count_of_orders" array field with value 2. When we bought some crypto the value turns to 0. 0 means not allowed to by on this level!!! The script buy if the bar is green only(last tick).

The script check every level(those we can see in "price_to_sellBue" array).
If the price across one of them - full script runs. After buying(if it possible) we check is there any crypto for sell on the level.
We check all levels below actual level( of actual level - ''i'' than we check all levels from 0 to i-1).
If there is any order that has value 0 in count of orders and index <= i-1 - we count it to var SELL amount and in the end of loop sell all of it.
Pay attention - it sells only if price across the level with red bar AND HAS ORDERS TO SELL WHICH WAS BOUGHT BELOW!!!

In Strategy tester it shows not-profitables orders sometimes, because if You have old Long position - it sells it first. First in - first out.
If the price goes down for a long time and You sell after 5 buys You sell the first of it with the highest value.

There is 2 protection from horrible buying in this strategy. The first one - Supertrend. If the supertrend is red - there is no permission for buy.
The second one - something between PIVOT and supertrend but with switcher.
If the price across last minimum - switcher is red - no permission for buy and the actual price becomes last minimum . The last maximum calculated for last 100 bars.
When the price across last maximum - switcher is green, we can buy. The last minimum calculation for last 100 bars, last maximum is actual price.

This two protections will save You from buying if price get crash down.

Enjoy my script.

Should You need the code or explanation, You have any ideas how to improve this crypt, contact me.

Vladyslav.
Jun 12
Release Notes: Here has been uncommented the protection for buy in case of price get down.
5 hours ago
Release Notes: Changed rages up to actual price to make it work
סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?

רעיונות קשורים