Buying gap lower with Parabolic SAR

Questions about MultiCharts and user contributed studies.
chimcentral
Posts: 2
Joined: 12 Jul 2018

Buying gap lower with Parabolic SAR

Postby chimcentral » 12 Jul 2018

i am trying to get my gap signal to work, having issues with [Intrabarordergeneration = True]. i know that when i enable, it essentially means "next bar" is next tick really.

so, what i am trying to do is, buy a gap lower on daily bar, if Parabolic SAR is negative (going down). i have a stop using average true range also.

it does work half of the time. sometimes, when there is a gap, and SAR is NOT negative on open, but ends up crossing negative, it will buy once it crosses negative. i only want to trade the open; is there a way to do so if IOG is on? i also tried adding 5 min data into chart, and this code...

if (var2 = -1) and marketposition = 0 and date > date[1] and open < low[1] and time of data2 < 850 then....

...but when i did so, no trades occurred.

below is my code.

Code: Select all

[Intrabarordergeneration = True]
inputs:  AfStep( 0.02 ), AfLimit( 0.2 ), n_risk(3);
variables:  var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 );   

Value1 = ParabolicSAR( AfStep, AfLimit, var0, var1, var2, var3 );

{get long}
if (var2 = -1) and marketposition = 0 and date > date[1] and open < low[1] then
{When IntraBarOrderGeneration is turned on, next bar really means next tick}
   Buy next bar at open;
       
{sell if long}
if marketposition = 1 then
   Sell next bar at var0 limit;

{stop}
SetStopPosition;
if MarketPosition = 1 then
   SetStopLoss((AvgTrueRange(20)) * (n_risk * CurrentContracts));



version information:
Version: MultiCharts64 Version 11.0 Release (Build 16148)

using InteractiveBrokers for data/execution.

image shows the working and non-working instances. my example is using SPY underlying...

Image
Last edited by chimcentral on 12 Jul 2018, edited 2 times in total.

User avatar
TJ
Posts: 6938
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1988 times

Re: Buying gap lower with Parabolic SAR

Postby TJ » 12 Jul 2018

See posts #1 & #2
viewtopic.php?t=11713

User avatar
TJ
Posts: 6938
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1988 times

Re: Buying gap lower with Parabolic SAR

Postby TJ » 12 Jul 2018


chimcentral
Posts: 2
Joined: 12 Jul 2018

Re: Buying gap lower with Parabolic SAR

Postby chimcentral » 12 Jul 2018

thanks for the tips TJ. hope i fixed correctly. not sure what to replace the variables with, they are stock var's from the Parabolic SAR indicator, not sure exactly what to name them.


Return to “MultiCharts”