(String sReason, IndicatorCandle c, int bar, int iDirection = -1)
| 165 | } |
| 166 | |
| 167 | private void OpenPosition(String sReason, IndicatorCandle c, int bar, int iDirection = -1) |
| 168 | { |
| 169 | String sD = String.Empty; |
| 170 | |
| 171 | if (iDirection == 1) |
| 172 | { |
| 173 | sLastTrade = "Bar " + bar + " - " + sReason + " LONG at " + c.Close; |
| 174 | sD = sReason + " LONG (" + bar + ")"; |
| 175 | } |
| 176 | else |
| 177 | { |
| 178 | sLastTrade = "Bar " + bar + " - " + sReason + " SHORT at " + c.Close; |
| 179 | sD = sReason + " SHORT (" + bar + ")"; |
| 180 | } |
| 181 | |
| 182 | if (iPrevOrderBar == bar) |
| 183 | return; |
| 184 | else |
| 185 | iPrevOrderBar = bar; |
| 186 | |
| 187 | OrderDirections d = OrderDirections.Buy; |
| 188 | if (c.Open > c.Close || iDirection == -1) |
| 189 | d = OrderDirections.Sell; |
| 190 | if (c.Open < c.Close || iDirection == 1) |
| 191 | d = OrderDirections.Buy; |
| 192 | |
| 193 | Order _order = new Order |
| 194 | { |
| 195 | Portfolio = Portfolio, |
| 196 | Security = Security, |
| 197 | Direction = d, |
| 198 | Type = OrderTypes.Market, |
| 199 | QuantityToFill = 1, // GetOrderVolume(), |
| 200 | Comment = sD |
| 201 | }; |
| 202 | OpenOrder(_order); |
| 203 | } |
| 204 | |
| 205 | } |
| 206 | } |
nothing calls this directly
no outgoing calls
no test coverage detected