mirror of
https://github.com/KhizarImran/backtestingfx.git
synced 2026-08-09 18:21:04 +00:00
feat: stoploss and take profit implementation on the broker.rs
This commit is contained in:
@@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user