Buy At Open If Overnight Price Change > 5%
Author: SoundFinancialConseling
Creation Date: 5/28/2020 3:27 AM
profile picture

SoundFinancialConseling

#1
Hey Guys:

I know nothing about using the programming script. I am trying to get this script to buy a security at market open if the price increased by => 5% overnight. This script is not doing that, but I don't know how to make the necessary changes.

Can anyone help?

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hi,

Option 1. You cannot really condition a market order that way because you place it before you know the open price but a stop should do it:

CODE:
Please log in to see this code.


Option 2. The Fidelity static provider filters out pre/post market data for stocks. With GetSessionOpen you can issue a market order shortly after the open but it's less convenient e.g. have to schedule the strategy in the Strategy Monitor with custom Execute time like 9:35.

CODE:
Please log in to see this code.


Option 3. I created a premarket scanner for MarketWatch.com so gaps up/down can be known beforehand. This can be used for live trading stocks that are about to gapp up with a simple BuyAtMarket script.
profile picture

superticker

#3
For Option 2, in the line below, please explain to me when openTradeBar would be a negative price. That is, when openTradeBar>0 is not true.
CODE:
Please log in to see this code.
profile picture

Eugene

#4
It does not imply that openTradeBar can be a negative price. But it can and will be 0 in a situation documented in the QuickRef > GetSessionOpen property.
profile picture

SoundFinancialConseling

#5
Thank you!

profile picture

Eugene

#6
You're welcome. Oops, I missed the link to the premarket scanner (Option 3) yesterday. Here it goes:

Fidelity limit doesn't place if 10% lower, see post #10

The code works but has to be run during premarket, not before.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).