OPEN-SOURCE SCRIPT

BUY/SELL on the levels only

Atualizado
My discribe is:

There ara a lot of levels we would like to buy some crypto.
When the price has acrossed 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 hiegher 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(supertrend and PIVOT)
Notas de Lançamento
Hello there,

Uncomment this section before use for real trade:
if array.get(price_to_sellBue, i) >= open[0] and array.get(price_to_sellBue, i) <= close[0]// and
//direction[0] < 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 warking 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 beetwen 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.

Sould You need the code or explanation, You have any idias how to improve this cript, contact me.

Vladyslav.
Notas de Lançamento
Here has been uncomented the protection for byu in case of price get down.
Notas de Lançamento
Changed rages up to actual price to make it work
Bands and ChannelsCycles

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal