Allow same bar exit / entry signal

Hi,

I realize I cannot use the "Allow same bar entr/exit signal" setting in the backtester for a script to trade real time. Can the same setting be applied in an AFL? I do not see a SetOption() for it.

Thanks,

Mike

@reds, from documentaion:

SetOption

  • sets options in automatic analysis settings Trading system toolbox
    (AFL 2.3)
SYNTAX SetOption( field, value )
RETURNS NOTHING
FUNCTION Sets various options in automatic analysis settings. Affects also Equity() function results.

field - is a string that defines the option to change. There are following options available:

  • "NoDefaultColumns" - if set to True - exploration does not have default Ticker and Date/Time columns
  • "InitialEquity"
  • "AllowSameBarExit"
    ...

Is this NOT the one you are looking for?

I don't think so but I may be wrong. I think "AllowSameBar" exit permits a position to be entered at the Open and exited on the same bar, in a range between the HLC. I think the "Allow same bar exit /entry signal" allows for a Long position to be exited on the Open and a Short position to be entered on the same Opening price, allowing the capital from one leg to be utilized in a different leg.

I will give your suggestion a try.

Thanks,

Mike

@reds, also take a look at this past thread. It seems related to your question.

I hope some more experienced traders will join this discussion since this is one of the many backtester settings dialog parameters that I never used.

I think I have a workable solution. If I check if I have a Cover and Buy signal or a Sell and Short signal on the same bar at the Open, I can multiply my position size by 2 or 1 to allow position size to be doubled. It seems to be effective.

Do you see any issues with this?

Thanks,

Mike

BM=IIf(Buy && Cover,2,1);
SM=IIf(Short && Sell,2,1);

I believe you are looking for real-time trading, hence use ValueWhen function and tweak as per your need for example below is the snippet that I used in a different manner.

Buy = // Your Buy Signal
_Sell = // Your Sell Signal
Short = //Your Short Signal
_Cover = //Your Cover Signal 
_SL = //Your Stoploss Signal 

Sell = ValueWhen(C,H>=_Sell) | ValueWhen(C,L<=_SL);
Cover = ValueWhen(C,L<=_Cover) | ValueWhen(C,H>=_SL);

ABC

Hi deepuanant,

Thank you, I will implement your suggestion.

Mike

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.