|
umair
2013-02-03 01:00:58
|
|
Buy if price crosses opening price of the day +.50 points
Only one trade per day. Price is the last trade.
Any assistance will be much appreciated!
|
|
|
|
umair
2013-02-03 06:16:14
0
|
|
+stoploss of ''0'' points
Does that mean that if the price goes below my entry price, the system will sell at the next bar?
|
|
|
|
QuantShare
2013-02-04 09:46:55
0
|
|
To buy when price crosses opening price of the day + 0.5 points, type the following formula:
buy = close > (open + 0.5);
|
|
|
|
umair
2013-02-05 03:49:07
0
|
|
Thanks the logic works but not quite what I'm trying to do:
Opening price I want to use is the price at 9:30. Not every single candle. So if the market opened today at 9:30 and the price was 100. I want to buy if the price crosses 100.5
What the above formula is doing is that it keeps buying everytime a 1 min candle has a close > open+.5
Also how can I tell the logic to close all positions at EOD. B/c I'm noticing that some of my logics end up buying the stock at 4PM (the last minute of trading hours) and then the position wont be sold till the next day. This happens even though my sell logic is "(hour() == 16 and minute() == 00)"
|
|
|
|
umair
2013-02-05 03:58:03
0
|
|
Example:
9:30 price= 100
9:35 price= 100.5
BUY at 100.5 or next opening minute bar
Just one trade a day, meaning once my profit target/stoploss is hit, the logic exits my position and waits till the next day
|
|
|
|
umair
2013-02-05 04:10:26
0
|
|
buy = close > (ref(open,(hour() == 9 and minute() == 30)) + 0.2)
Thats what I have but It does not work properly.
|
|
|
|
umair
2013-02-05 04:43:13
0
|
|
buy = close > (TimeframeGetSeries1("A", 1, close, LastData, 1) + (0.5))
Still doesn't work.
|
|
|
|
QuantShare
2013-02-05 12:25:51
0
|
|
I thought you were backtesting an EOD system.
To get the open price of today:
a = HistoPrice(_open, 0);
Note that you can always plot a variable on a chart to see exactly how it works.
|
|
|
|
umair
2013-02-05 18:38:56
0
|
|
How can I limit my buy logic to only trigger a buy once a day?
|
|
|
|
QuantShare
2013-02-05 20:55:54
0
|
|
Add the following rule:
hour() == 9 and minute() == 30
|
|
|
|
umair
2013-02-06 04:25:54
0
|
|
Hi Quant, there has to be a better way to limit the logic to only trigger once.
''hour() == 9 and minute() == 30'' will not work since my limit order is open price at 9:30 + .20 points. Lets say at 10AM the price croses day's opening price+.20 points I want to buy then, and then sell at my profit target or EOD. And if my profit target is hit at 11AM, then I don't want the logic to trigger again. Right now it's triggering again since the price at 11AM is > days opening price+.20
|
|
|
|
QuantShare
2013-02-06 11:00:02
1
|
|
You have many solutions:
- Solution 1: Using the strategy formula, you can type something like:
rule1 = close > HistoPrice(_open, 0) + 0.2;
newday = barssince(day() != ref(day(), 1));
buy = sumif(rule1, 1, newday+1) == 1 and rule1;
- Solution 2: Set "'hour() == 9 and minute() == 30" as buy rule then set a stop order with "HistoPrice(_open, 0) + 0.2" as stop rule
- Solution 3: Use the money management script to implement that
|
|
|
|
umair
2013-02-06 15:45:54
0
|
|
Great, thx Quant
|
|
|
|
umair
2013-02-07 02:56:42
0
|
|
Hey Quant any idea the below isn't capturing all the gap downs? Gap down= today's opening price < yesterday's closing price. And I only want to make one trade per day.
rule1 = histoprice(_open, 0) < HistoPrice(_close, 1);
newday = barssince(day() != ref(day(), 1));
buy = sumif(rule1, 1, newday) == 1 and rule1;
It's making trades but it's not capturing all the gap downs that I can see on the chart
|
|
|
|
umair
2013-02-07 03:02:43
0
|
|
nvm that works..
|
|
|
|