feat: stoploss and take profit implementation on the broker.rs

This commit is contained in:
KhizarImran
2026-06-13 12:01:44 +01:00
parent 516f6029ac
commit 9847a99561
4 changed files with 65 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ struct BuyEveryBar;
impl Strategy for BuyEveryBar {
fn next (&mut self, bar: &Bar, broker: &mut Broker) {
broker.close_all(bar.close, bar.timestamp); //closes any open positions
broker.buy(bar.close, 1.0, bar.timestamp); // can be more complicated with buy, sells, close position, close all etc.
broker.buy(bar.close, 1.0, bar.timestamp, None, None); // can be more complicated with buy, sells, close position, close all etc.
}
}