trading view script CS AF

Job ID: 33475094

Budget: $30 – $250 NZD

Need a script for the tradingview app using pine editor to fire at certain events and initiate trades with a connected broker.
I have written several scripts and started o this but run out of time.
This script will create a buy or sell order when the live price crosses various levels set via the Input Options.
The user will be able to set an Upper Range price and a Lower Range price, and activate or de-activate the strategy. The user will also be able to enter the take profit and stop loss price.
When activated, and the live price of the trading pair crosses the Upper Range, a long order will be created either with the strategy tester or a live broker. And conversely, when the trading pair crosses the Lower Range a short order will be created.
Furthermore, if price moves X% higher (as defined via the Input Option) than the first short, then a second short order will automatically be placed.
And conversely, a second long order will be placed, if price moves X% lower than the first long order price level.
The Stop Loss will be set based on a percentage lower or higher than the Long or Short order, which can be entered via the Input Option. For example if a Long order is placed at $3 and the Stop Loss is 0.008, then the Stop Loss will be set at $3-($3 x 0.008). Conversely the Stop Loss for a short order at for example $4 will be added to the Short Order, eg $4+($4 x 0.008).
The Take Profit will be the be able to set by the user, as a percentage move, eg if 0.1 entered then the Take Profit will be $3+($3 x 0.1), and conversely for a short order.
Long and short orders for the above conditions can only be placed once the former order has closed, ie a maximum of four orders can be in play at any one point in time.
For example, the user enters an Upper Price of $4 and Lower price of $3. They set the % move higher as 0.1 and 0.2 for the move lower. They set 0.01 as the Stop Loss, and 0.2 as the Take Profit.
Price is currently $3.15, The user toggles the strategy. When price hits $3 a long order is placed with a Take Profit of $3.60 ($3+($3 x 0.2)) and a Stop Loss of $2.97($3-($3x0.01). A second Long order automatically triggers when price moves down to $2.40 ($3-($3x0.2), and places a Take Profit and Stop Loss based on the same variables for the first order.
Price then moves up to $4.01. As it passes $4, the short order triggers and a short is created with a Take Profit of $3.60 ($4-($4x0.1) and Stop Loss as per above. If price continues higher to $4.10 ($4+(0.1x$4)), then the second short order triggers.
If price goes above and below $4, eg up to $4.02, down to $3.97 then back up to $4.05, then no further orders will be placed until the original sell order has closed, ie reached it’s Take Profit or Stop Loss.
Related categories: Pine Script