Using Kase range bars and the following code to trade inside a 8 full point bar.
The orders using brackets will enter and exit within the bar, if there is a loss I wish to flip the trade at the close of the bar ;
I have tried many times and must be overthinking it to get it to work. I'm at a loss of logic.
Any help would be appreciated comments to nudge me, not asking for actual code.
[IntrabarOrderGeneration = true]
///////////////////////////////////////////////////////////////////////////////
if l>pp and h=c then begin buy num contracts this bar on c ; end ;
///////////////////////////////////////////////////////////////////////////////
if h<pp and l=c then begin sell short num contracts this bar on c ; end ;
///////////////////////////////////////////////////////////////////////////////
setprofittarget_pt(10) ;
setstoploss_pt(20) ;
Flip trade
- Mark Brown
- Posts: 181
- Joined: 29 Nov 2016
- Has thanked: 111 times
- Been thanked: 17 times
- Vlada MultiCharts
- Posts: 293
- Joined: 22 Apr 2020
- Has thanked: 8 times
- Been thanked: 76 times
Re: Flip trade
Hello Mark
Please try the following solution:if there is a loss I wish to flip the trade at the close of the bar
Code: Select all
[IntrabarOrderGeneration = true];
buy next bar at market;
//exit with position if openpositionprofit is loss
if openpositionprofit < 0 then
begin
sellshort this bar at close;
buy this bar at close;
end;