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

[amibroker] Re: Resetting trade delays based on value of variable



PureBytes Links

Trading Reference Links

I have a system that can be enhanced if I can change the trading
delays when certain conditions are met. There must be some way in AFL
to set trade delays to one value for condition 'A' and then reset the
the trading delays when condition 'B' is met.
Ridiculous example:
SetTradeDelays(1,1,1,1);
BigGame = (IIF(AZ_Cardinals = Win, "Amazing", "Figures");
IIF(BigGame = "Amazing", SetTradeDelays((2,2,2,2),
SetTradeDelays(0,0,0,0);
Buy = <<something>>;
Sell = <<something else>>;

  Pete  :-)



--- In amibroker@xxxxxxxxxxxxxxx, dingo <dingo@xxx> wrote:
>
> why don't you just use SetTradeDelays(0,0,0,0)  and then if you want
a delay
> add it in your code?
> 
> d
> 
> On Sat, Aug 16, 2008 at 10:09 PM, Pete <dryheat3@xxx> wrote:
> 
> > I spent some more time trying to work this out and could not find some
> > way to verify if this is working. However, I found a much less complex
> > method to apply this technique (see code below), but I still cannot
> > get it to do what I expect. Example: comment out the line of code for
> > the SetTradeDelays and run the back test. I get slightly different
> > results but when I drill down into individual trades the exits are
> > occurring on the day of the signal whether the line of code in place
> > or commented out.
> >
> > //[code]*************************************************
> > SetTradeDelays(0,0,0,0);
> > BuyPrice = Open;
> > SellPrice = Open;
> >
> > Buy = <<insert buy rule here>>
> > fltr = <<some test value to see if delays should be adjusted>>
> >
> > tstDly = WriteIf(fltr == 1 , "1", "0");
> > SetTradeDelays(0, 0, StrToNum(tstDly) , StrToNum(tstDly) );
> >
> > sell = <<insert sell rule here>>
> > //[/code]************************************************
> >
> >  Pete  :-)
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Pete" <dryheat3@> wrote:
> > >
> > > Just wondering if this is even possible. I checked the AFL help
files,
> > > searched the online AFL Formula reference and also searched this
yahoo
> > > group. Every example only shows the SetTradDelays() function being
> > > used one time in the code and never 'adjusted' to some other value
> > > based on a condition. I created this function which seems to me
should
> > > work correctly but I have no way to really be sure it's working as
> > > designed. I am using the printf() function several times to keep
track
> > > of different values during bar replay, (thanks to Razzbarry), but I
> > > can't find a way to print the values of the trade delays to the
output
> > > window.
> > > //[code]*************************************************
> > > SetTradeDelays(0,0,0,0);
> > > BuyPrice = Open;
> > > SellPrice = Open;
> > >
> > > Buy = <<insert buy rule here>>
> > > fltr = <<some test value to see of delays should be adjusted>>
> > > function dly()
> > > {
> > >       if (fltr == 1)
> > >       SetTradeDelays(0,0,1,1);
> > >       else
> > >       SetTradeDelays(0,0,0,0);
> > > }
> > > sell = <<insert sell rule here>>
> > > //[/code]************************************************
> > >
> > > The goal here is to change the trade delays to 0,0,1,1 only if the
> > > fltr variable returns a true value of 1.
> > > Thanks for taking the time to check this out.
> > >
> > >   Pete  :-)
> > >
> >
> >
> >
> > ------------------------------------
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> > Yahoo! Groups Links
> >
> >
> >
> >
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

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

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