Skip to content

Commit

Permalink
Merged conflict resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ooples committed Apr 3, 2022
2 parents 6ea1c2a + 5acad4c commit 639a2e7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var stockData = new StockData(openPrices, highPrices, lowPrices, closePrices, vo
var results = stockData.CalculateRelativeStrengthIndex().CalculateMovingAverageConvergenceDivergence();
```

Here is an example to get you started using the [Alpaca C# Api](https://github.com/alpacahq/alpaca-trade-api-csharp)
Here is a simple example calculating default bollinger bands to get you started using the [Alpaca C# Api](https://github.com/alpacahq/alpaca-trade-api-csharp)

```cs
using Alpaca.Markets;
Expand All @@ -28,15 +28,14 @@ var client = Environments.Paper.GetAlpacaDataClient(new SecretKey(paperApiKey, p
var bars = (await client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, startDate, endDate, BarTimeFrame.Day)).ConfigureAwait(false)).Items;
var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc));

// simple example showing default bollinger bands
var results = stockData.CalculateBollingerBands();
var upperBandList = results.OutputValues["UpperBand"];
var middleBandList = results.OutputValues["MiddleBand"];
var lowerBandList = results.OutputValues["LowerBand"];
```

Here is a more advanced example showing how to calculate bollinger bands with full customization and using a custom input of high rather than the default close
```cs
// more advanced example showing bollinger bands with full customization and using a custom input of high rather than the default close
var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low),
bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc), InputName.High);

Expand Down Expand Up @@ -65,4 +64,4 @@ Patreon: [https://patreon.com/cheatcountry](https://patreon.com/cheatcountry)

### Support or Contact

Email me at [email protected] for any help or support.
Email me at [email protected] for any help or support or to let me know of ways to further improve this library.

0 comments on commit 639a2e7

Please sign in to comment.