[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Time Calculation and Testing in Intraday charts



PureBytes Links

Trading Reference Links

Dear All,

I am trying to write a code that should provide Buy/Sell Signal with in a time frame in intraday bars. I tried to use Hou() and Minute() functions to find time of current bar but it seems it doesnt work. Depending on my conditions, I get Buy/Sell signals for all day. The following is the Extract of my code that I tested. Please correct this code on how to test time in intraday bars. Frequency of bars doesn't matter, any periodicity from 5 min to 60min will do....

Below is the Indicator Code that I am trying to test. In Expert Advisor, I am calling these Function Variables and Parameters Only. Please suggest where I made mistakes...

Thanks in Advance...

Thanks and Regards,
Amit Trivedi
President & CEO
Athenasolutionz.com - "We sell hope, in the stock market."


{Define Parameters}

Length := Input("Value of Length for Lookback Periods", 1,10,5);
SHr := Input("The Starting Hour for Entering Trade", 8, 13,9);
LHr := Input("The Value of Last Hour for Entering Trade", 8,16,14);
Lmin := Input("The Value of First and Last Minute for Entering Trade", 00,59,55);



{Define Local Variables}
LongPos := 0; ShortPos := 0; Posize := 100; Cum(LongPos)= 0; Cum(ShortPos)= 0; lookback := Length*2; 

BuyLong := Condition1 AND Condition3;
BSL := ((( Posize*BuyLong) - 1500)/Posize); {-- BuyStop loss of Rs.1500 for position size of 100.}
SS := Condition2 AND Condition3; 
SSL := ((( Posize*SS)+1500)/Posize); {-- Sell Stop loss of Rs.1500}


{ -----------*------- Program Begins -----------*----------}

{Check Time for Entering Trade}

If( (DayOfMonth() AND Month()) AND (Hour() >=SHr AND Minute() >= Lmin) AND (Hour() <= LHr AND Minute()<= Lmin), 
{Then} {This Condition is for getting Buy/Sell Signal for Today only, Previous Days' Signals should not be displayed on Chart}
If( Condition3 <>0), 
{Then} 

        If( Cum(LongPos) = 0 AND Cum(ShortPos) = 0, 
        {Then}
            If( H >= BuyLong, 
            {Then}
                BuyLong AND Cum(LongPos) = Cum(LongPos)+1 AND Cum(ShortPos)= Cum(ShortPos)-1 AND 
                BSL, 
            {Else}
                BuyLong = 0 AND BSL = 0), 
        {Else IF} 

            If( L <= Condition2, 
            {Then}
                    SS AND Cum(SP)= Cum(SP)+1 AND Cum(LP)= Cum(LP)-1 AND {SP = ShortPos, LP = LongPos}
                    SSL= ((( Posize*SS)+200)/Posize), 
                {Else}
                    SS =0 AND SSL =0)), 

        {Else}0), 

{Else} 0);

BuyLong; BSL; SS; SSL;

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/