Hey guys,
I'm having some issues, all related to having multiple timeframes. I read all the posts I can find (even my own) and I thought I had incorporated the proper code, but still something is off.
The following is just an example for me to better understand how this works.
I would just like a simple daily model to be updated throughout the day on minute data.
I'm trying to get to look at the MACD Daily to see if it is above 0, and the minute is to monitor how it trades throughout the day (1 min) and buy when the stock price close on that minute bar hits the close from yesterday (between 10am and 3:30pm) and at that price (yesterday's close).
I thought the following should work, but for some reason it does not. I tried to AddColumn and see what the data is, but nothing pops up on Exploration either (no trades at all).
Any idea of what I am doing wrong?
Thanks so much for any help or suggestions!
//Daily used with 1min real time data
SetPositionSize(10, spsPercentOfEquity);
dailyTM = inDaily;
TimeFrameSet (dailyTM);
DMACDPos = MACD (12,26) > 0;
DMACDNeg = MACD (12,26) < 0;
YClose = Ref (Close, -1);
TimeFrameRestore();
expand_mode = expandLast ;
DMACDPos = TimeFrameExpand(DMACDPos, dailyTM, expand_mode);
DMACDNeg = TimeFrameExpand(DMACDNeg, dailyTM, expand_mode);
YClose = TimeFrameExpand(YClose, dailyTM, expand_mode);
Time = TimeNum();
startTime = 100000;
endTime = 153000;
TimeCheck = Time >= startTime AND Time <= endTime;
Buy =
DMACDPos
AND Close < YClose
AND TimeCheck
AND BuyPrice = YClose
;
Sell = DMACDNeg;
AddColumn( C, "Close" );
AddColumn( DMACDPos, "DMACDPos" );
AddColumn( DMACDNeg, "DMACDPos" );
AddColumn( YClose, "DMACDPos" );