Does my formula look into the future?

Does the formula:
bars = IIf( Close < Ref( Close, -15), 15, 100000);
ApplyStop(stopTypeNBar, stopModeBars, bars, 2, True);
look into the future, as i tend to think, or is ChatGpt right in vehemently denying it, stating that after the exit condition of c<ref (c,-15) is met, amibroker waits 2 bars before exiting?
Thanks!

ChatGPT is NOT the source of information. It is source of story telling and hallucinaton see this. People forget that all those chatbots are for CHAT (fun). When it comes to science and facts they are pretty much useless. You can ask ChatGPT to write poem about bubble gum, but any fact checking is really bad idea.

I am not sure what you are trying to achieve and it will be better if you describe the GOAL as explained here How to ask a good question
because usually go into trap of narrow thinking and become hard-wired to one formula while proper solution to reach the GOAL may be completely different.

You can check whenever formula looks into the future or not using AmiBroker itself, Formula Editor (Tools->Code check and profile)

Indeed, that's what "code check and profile" replied: "It seems that the formula references FUTURE quotes.
If you backtest this system you may receive outstanding results
that CAN NOT be reproduced in real trading." much more reliable than ChatGpt. i was not aware of this function in Amibroker. Thanks!

These two lines that you posted don't cause that. OTHER lines (that you did NOT include) reference future quotes. Code Check And Profile checks ENTIRE formula.
Post ENTIRE formula. Otherwise discussion is pointless.

Well, now i am confused. I stripped all complexities from my formula, remaining with the simple part attached bellow, and still getting the "formulav references futute" warning. Why?

_SECTION_BEGIN("i");

SetTradeDelays(1,1,1,1);
RoundLotSize = 1;

PosQty=10;
SetOption("MaxOpenPositions", PosQty );
PositionSize = -100/PosQty; ;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}};O= %g, H= %g, L= %g,{{VALUES}})",C , O, H, L));

n1 = 9;
n2 = 26;
n3 = 52;

TenkanSen =(HHV(H,n1)+LLV(L,n1))/2;
KijunSen =(HHV(H,n2)+LLV(L,n2))/2;
ChinkouSpan =Ref(C,-n2);
Cks = Close;
SenkouSpanA =Ref((KijunSen+TenkanSen)/2,-n2);
SpA =(KijunSen+TenkanSen)/2;
SenkouSpanB =Ref((HHV(H,n3)+LLV(L,n3))/2,-n2);
SpB =(HHV(H,n3)+LLV(L,n3))/2;
DL = Ref( C, 25 );

BuyCond1 = Cross(TenkanSen,KijunSen); //AND (DL>Close);
SellCond1 = Cross(KijunSen,TenkanSen) ;//AND (DL<KijunSen);

Buy =BUYCOND1 ;
Sell= sellcond1;

Thanks.

You get it because of upper line.
You forgot to add minus sign.

DL = Ref( C, -25 );


And if inserting code to forum you are supposed to use code tags.

1 Like

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