I am trying to find out how to get it so that once my strategy executes an order, i want to be able to adjust the stop and profit target on my chart. Right now, my code when it places and the trail logic is so whack that if i move it, the order moves back to the position it was previously and moves based on the logic hardcoded. It won't adjust to me moving it on the chart.
This i what i want to code:
INPUT PARAMETERS BY USERS:
Profit Target: [by points]
Stop Loss: [by points]
Trail By: [by points]
Break Even: [by dollar amount]
CODE: (example condition when 50MA moves above 200MA go long and if it goes below go short)
if {condition is met}
{
go long
else
{condition2 is met}
go short
}
Whenever there is an order that executes, the profit target is set and stop loss is set.
Trail Stop loss by parameter [Trail by]
Whenever the position is in profit by $50, move stop loss to break even.
On chart, if we move the stop loss with mouse, it should move to the price we move it to and continue trail from there by [trail by] parameter.
On chart, if we move the profit target, it should move and stay in that price.
Comment