# Buy and Sell in the same day

**URL:** <https://forums.collective2.com/t/buy-and-sell-in-the-same-day/8271>\
**Category:** Seetu\
**Created:** [October 11, 2015, 8:24pm UTC](https://forums.collective2.com/t/buy-and-sell-in-the-same-day/8271 "2015-10-11T20:24:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoamMizrachi](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/noammizrachi/32/1487_2.png) [@NoamMizrachi](https://forums.collective2.com/u/NoamMizrachi)\
**Post date:** [October 11, 2015, 8:24pm UTC](https://forums.collective2.com/t/buy-and-sell-in-the-same-day/8271/1 "2015-10-11T20:24:53Z")

</div>

Hi,

How can I buy and sell a stock with Open price at the beginning of the day and to Sell at the end of the day.  
For example AAPL :

- start a day at 53.5 - I want to Buy
- end the same day at 54.0 - I want to Sell .

Thanks  
-

---

<div class="post-metadata">

**Author:** ![BobSvan2](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/bobsvan2/32/21391_2.png) [@BobSvan2](https://forums.collective2.com/u/BobSvan2)\
**Post date:** [October 14, 2015, 10:21am UTC](https://forums.collective2.com/t/buy-and-sell-in-the-same-day/8271/3 "2015-10-14T10:21:06Z")

</div>

Implemented.

There is an option “AllowSameBarExit” in Seetu now:

```
SetOption("AllowSameBarExit",FALSE);

```

or

```
SetOption("AllowSameBarExit",TRUE);

```

A default value (when this option is not used at all) is FALSE

* * *

Here is an example code:

```
SetOption("AllowSameBarExit",TRUE);

BuyPrice = Open; // Buy at Open prices
SellPrice = Close; // Sell at Close prices

Buy = Cross(CalcMACD(), CalcMACDSignal());

// Sell at the same bar
Sell = Buy;

```

**Effects:**

1. SetOption(“AllowSameBarExit”,FALSE);

![](https://yyz2.discourse-cdn.com/flex028/uploads/collective2/1776/952deec0064a86b3.png)

1. SetOption(“AllowSameBarExit”,TRUE);

![](https://yyz2.discourse-cdn.com/flex028/uploads/collective2/1777/b7bf7e2c6d13b404.png)

Happy trading!

---

<div class="post-metadata">

**Author:** ![NoamMizrachi](https://yyz2.discourse-cdn.com/flex028/user_avatar/forums.collective2.com/noammizrachi/32/1487_2.png) [@NoamMizrachi](https://forums.collective2.com/u/NoamMizrachi)\
**Post date:** [October 15, 2015, 10:42am UTC](https://forums.collective2.com/t/buy-and-sell-in-the-same-day/8271/4 "2015-10-15T10:42:19Z")

</div>

Thanks Bob. It’s very helpful
