- ago
How can I put a stop loss under the low of the signal bar?
and how can I put a profit target based on this stop loss?
for example 2x1 (return x risk), if i bought in 10$ and my stop loss is under the low of the signal bar (in this case 5$) my profit target will be at 20$ (10$ from where i bought).
[Building Blocks]
0
670
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
While this doesn't seem to be possible to accomplish in Blocks yet, you could use Strategy code for this. When you finished with building your strategy from Blocks you could press "Open as C# coded Strategy" and make necessary edits. For example, this is for a stop order:

CODE:
//ClosePosition(foundPosition0, OrderType.Stop, foundPosition0.EntryPrice * value2, "Sell at 10% stop loss"); ClosePosition(foundPosition0, OrderType.Stop, bars.Low[foundPosition0.EntryBar] * value2, "Sell at 10% SL from signal bar's low");

1
- ago
#2
Also please consider voting for this feature request to expand Blocks. Once it gets to the top we'll add more conditions to fill in the missing pieces like the one you asked for:

https://www.wealth-lab.com/Discussion/Expand-Building-Blocks-5954
0
Best Answer
- ago
#3
thanks, the stop loss is working, but how can i put a profit target based on this stop?
something like 2:1(return : risk)
0
- ago
#4
Hope this helps:
CODE:
//ClosePosition(foundPosition0, OrderType.Limit, foundPosition0.EntryPrice * value, "Sell at 10% profit target"); double target = foundPosition0.EntryPrice + 2 * (foundPosition0.EntryPrice - bars.Low[foundPosition0.EntryBar]); ClosePosition(foundPosition0, OrderType.Limit, target, "Sell at 2x Risk (profit target)");
1
- ago
#5
thanks, you're an angel ;D
1
- ago
#6
It's my pleasure to help you :)
0

Reply

Bookmark

Sort