Daily Chart Signal intraday generation.
Posted: Aug 22 2012
I have been using daily charts to enter a trade using the enter on close feature. However I would like to enter them on the 5 minute chart instead to allow me to use more fine tuning. I have used data2 correctly however when comparing the daily vs the modified 5 minute entry i am coming up with discrepancies. Either Trades are not taken or are taken in correctly. I have included both codes the original daily i got from a forum and my modified. I was using YM.
originally on the daily it was this
I used print to debug date 1090625.00RSI 17.99
thats the value I got, however the close of the day already occurred and as we can see in the daily chart the RSI value is no longer meets the conditions.
When does the daily chart close and reload that value for a check by the 5 minute? I have been using 5 minutes after the close to enter but also tried 1 hour after. It doesn't effect it. I don't really know where i am going wrong and spinning my wheels. Any help would be great.
Code: Select all
{== START OF HEADER ==========================================================================
== END OF HEADER =============================================================================
== DEFINE ALL INPUTS AND VARIABLES ==========================================================}
Input: {-------------------------------------------------------------------------------------}
StopLoss$(1000), // Strategy Default Stoploss
BuyLevel(45), // RSI Buy Value
ExitLevel(65), // RSI Exit Value
TimeToEnter( 1600);
Variables: {---------------------------------------------------------------------------------}
LookBack(2), //RSI Look back period
RSI_Sum(0), // RSI sum variable
MA200(0), // 200 Moving Average value
MA5(0), // 5 Moving Average Value
TradeOK ( false); //Trade flag
{ === START OF MAIN PROGRAM ================================================================}
RSI_Sum = RSI(Close, Lookback) data2 + RSI(Close[1], Lookback) data2 + RSI(Close[2],Lookback) data2;
MA200 = Average(Close, 200)data2;
//Setting Trade Flag Based on Daily Charts
If ( RSI_Sum < BuyLevel ) And ( Close > MA200 ) Then
TradeOK = True
Else
TradeOK = False;
//Entry Logic + Time Check
If TradeOK = True and Time > TimeToEnter then
Buy ("RSI(2) Accum. LE") next bar at market;
{Debug}
IF MP[1] = 0 and MP[0] = 1 then
Print( "date ", date , "RSI ", RSI_Sum);
// Exit Logic
If ( MarketPosition <> 0 ) And ( RSI( Close, LookBack )data2 > ExitLevel ) Then sell this bar at close;
If ( StopLoss$ > 0 ) Then SetStopLoss( StopLoss$ );
{
If ( RSI_Sum < BuyLevel ) And ( Close > MA200 ) Then buy this bar at close;
}
{== END OF MAIN PROGRAM =====================================================================}
Code: Select all
RSI_Sum = RSI(Close,Lookback) + RSI(Close[1],Lookback) + RSI(Close[2],Lookback);
MA200 = Average(Close, 200);
If ( RSI_Sum < BuyLevel ) And ( Close > MA200 ) Then buy this bar at close;
If ( MarketPosition <> 0 ) And ( RSI( Close, LookBack ) > ExitLevel ) Then sell this bar at close;
If ( StopLoss$ > 0 ) Then SetStopLoss( StopLoss$ );
I used print to debug date 1090625.00RSI 17.99
thats the value I got, however the close of the day already occurred and as we can see in the daily chart the RSI value is no longer meets the conditions.
When does the daily chart close and reload that value for a check by the 5 minute? I have been using 5 minutes after the close to enter but also tried 1 hour after. It doesn't effect it. I don't really know where i am going wrong and spinning my wheels. Any help would be great.