Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //**********************************************************************************************//
- #region Pivot1 ATR
- pivot1_atr_allow= Pivot1_TrailingReversal = 1 or Pivot1_Exit______________ONOFF = 1;
- if pivot1_atr_allow then begin
- EntryFilter_MA1_ORB = avp_core_avg_types( close, ORB_MAPeriod, ORB_MAType, pivot1_atr_allow );
- if Pivot1_High_ATR_LeftFilter_Length > 0 then
- Pivot1_High_ATR_LeftFilter_val = tt_Average( TrueRange, Pivot1_High_ATR_LeftFilter_Length, 0, pivot1_atr_allow and Pivot1_High_ATR_LeftFilter_Length > 0);
- if Pivot1_Low_ATR_LeftFilter_Length > 0 then
- Pivot1_Low_ATR_LeftFilter_val = tt_Average( TrueRange, Pivot1_Low_ATR_LeftFilter_Length, 0, pivot1_atr_allow and Pivot1_Low_ATR_LeftFilter_Length > 0);
- if Pivot1_High_ATR_RightFilter_Length > 0 then
- Pivot1_High_ATR_RightFilter_val = tt_Average( TrueRange, Pivot1_High_ATR_RightFilter_Length,0, pivot1_atr_allow and Pivot1_High_ATR_RightFilter_Length > 0);
- if Pivot1_Low_ATR_RightFilter_Length > 0 then
- Pivot1_Low_ATR_RightFilter_val = tt_Average( TrueRange, Pivot1_Low_ATR_RightFilter_Length, 0, pivot1_atr_allow and Pivot1_Low_ATR_RightFilter_Length > 0);
- end;
- #endregion
- //**********************************************************************************************//
- #region Pivot 1
- // vars:
- // ix(0),
- // Last_Pivot1_High(0),
- // Last_Pivot1_Low(0),
- // Last_Pivot1_HighBar(0),
- // Last_Pivot1_LowBar(0),
- // the_Pivot1_High(0),
- // the_Pivot1_Low(0),
- // Pivot1_HighRev(0),
- // Pivot1_LowRev(0),
- // MR_High(0),
- // MR_Low(0),
- // intrabarpersist the_Pivot1_High_CheckRight(false),
- // intrabarpersist the_Pivot1_Low_CheckRight(false),
- // intrabarpersist Valid_Pivot1_High(0),
- // intrabarpersist Valid_Pivot1_Low(0),
- // LeftAmt(0);
- Pivot1_XR_allow_temp = Pivot1_Exit______________ONOFF = 1 or Pivot1_TrailingReversal = 1;
- if Pivot1_XR_allow_temp then begin
- If BarComplete then begin
- // Must wait till close of bar to confirm pivots
- if PivotHighVSBar(
- iff(Pivot1_XR_allow_temp and BarComplete, 1, 0),
- high,
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_High_Left_Strength, 0),
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_High_Right_Strength, 0),
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_High_Right_Strength+1, 1)
- ) <> -1 then begin
- //if AVPPivotHighVSBar( high, Pivot1_High_Left_Strength, Pivot1_High_Right_Strength, MaxBarsBack ) <> -1 and BarComplete then
- Last_Pivot1_High = high[Pivot1_High_Right_Strength];
- Last_Pivot1_HighBar = barnumber[Pivot1_High_Right_Strength];
- // Filter amounts
- if Pivot1_Filter_Option = 1 then
- Pivot1_High_ATR_LeftFilter_Amt = Last_Pivot1_High * Pivot1_High_PctLeftFilter * 0.01
- else
- Pivot1_High_ATR_LeftFilter_Amt = Pivot1_High_ATR_LeftFilter_val * Pivot1_High_ATR_LeftFilter_Period;
- // Get left percent
- if TradeOnlySameDay then begin
- // if there is no valid low, use: low of day
- value1= iff (Valid_Pivot1_LowBar < NewDayBarNum, LowOfDay, Valid_Pivot1_Low ) ;
- end
- else begin
- // if there is no valid low, use: low of chart
- value1= iff (Valid_Pivot1_LowBar = 0, LowOfChart, Valid_Pivot1_Low );
- end;
- LeftAmt = Last_Pivot1_High - value1;
- // The pivot1 is valid only, if the pivot is :
- // - x% away from the opposite (left) pivot
- // - higher than the last valid swing pivot high
- if LeftAmt > Pivot1_High_ATR_LeftFilter_Amt or Last_Pivot1_High > the_Pivot1_High then begin
- the_Pivot1_High = Last_Pivot1_High;
- the_Pivot1_HighBar = Last_Pivot1_HighBar;
- the_Pivot1_High_CheckRight = true;
- end;
- end;
- if PivotLowVSBar(
- iff(Pivot1_XR_allow_temp and BarComplete, 1, 0),
- low,
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_Low_Left_Strength, 0),
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_Low_Right_Strength, 0),
- iff(Pivot1_XR_allow_temp and BarComplete, Pivot1_Low_Right_Strength+1, 1)
- ) <> -1 then begin
- //if AVPPivotLowVSBar( low, Pivot1_Low_Left_Strength, Pivot1_Low_Right_Strength, MaxBarsBack ) <> -1 and BarComplete then
- Last_Pivot1_Low = low[Pivot1_Low_Right_Strength];
- Last_Pivot1_LowBar = barnumber[Pivot1_Low_Right_Strength];
- // Filter amounts
- Pivot1_Low_ATR_LeftFilter_Amt = iff( Pivot1_Filter_Option = 1, Last_Pivot1_Low * Pivot1_Low_PctLeftFilter * 0.01, Pivot1_Low_ATR_LeftFilter_val * Pivot1_Low_ATR_LeftFilter_Period );
- // Get left percent
- if TradeOnlySameDay then begin
- // if there is no valid high, use: high of day
- value1 = iff ( Valid_Pivot1_HighBar < NewDayBarNum, HighOfDay, Valid_Pivot1_High);
- end
- else begin
- // if there is no valid high, use: high of chart
- value1 = iff ( Valid_Pivot1_HighBar = 0, HighOfChart, Valid_Pivot1_High);
- end;
- LeftAmt = value1- Last_Pivot1_Low;
- // The pivot1 is valid only, if the pivot is x% away from the opposite pivot
- // Exception if this is lowest than the last valid swing pivot low
- if LeftAmt > Pivot1_Low_ATR_LeftFilter_Amt or Last_Pivot1_Low < the_Pivot1_Low then begin
- the_Pivot1_Low = Last_Pivot1_Low;
- the_Pivot1_LowBar = Last_Pivot1_LowBar;
- the_Pivot1_Low_CheckRight = true;
- end;
- end;
- end;
- // Filter amounts
- if Pivot1_Filter_Option = 1 then begin
- Pivot1_High_ATR_RightFilter_Amt = the_Pivot1_High * Pivot1_High_PctRightFilter * 0.01;
- Pivot1_Low_ATR_RightFilter_Amt = the_Pivot1_Low * Pivot1_Low_PctRightFilter * 0.01;
- end
- else begin
- Pivot1_High_ATR_RightFilter_Amt = Pivot1_High_ATR_RightFilter_val * Pivot1_High_ATR_RightFilter_Period;
- Pivot1_Low_ATR_RightFilter_Amt = Pivot1_Low_ATR_RightFilter_val * Pivot1_Low_ATR_RightFilter_Period;
- end;
- // Stop checking for %Filter Right if price breaks the pivot high
- if the_Pivot1_High_CheckRight and high > the_Pivot1_High then
- the_Pivot1_High_CheckRight = false;
- if the_Pivot1_Low_CheckRight and low < the_Pivot1_Low then
- the_Pivot1_Low_CheckRight = false;
- // Check %Filter Right
- if the_Pivot1_High_CheckRight and close <= the_Pivot1_High - Pivot1_High_ATR_RightFilter_Amt then begin
- Valid_Pivot1_High = the_Pivot1_High;
- Valid_Pivot1_HighBar = the_Pivot1_HighBar;
- the_Pivot1_High_CheckRight = false;
- end;
- if the_Pivot1_Low_CheckRight and close >= the_Pivot1_Low + Pivot1_Low_ATR_RightFilter_Amt then begin
- Valid_Pivot1_Low = the_Pivot1_Low;
- Valid_Pivot1_LowBar = the_Pivot1_LowBar;
- the_Pivot1_Low_CheckRight = false;
- end;
- // If the last valid swing pivot high today was broken calculate the highest price that occurred after the break
- if Pivot1_HighBreakBar = Valid_Pivot1_HighBar and Valid_Pivot1_HighBar >= NewDayBarNum then begin
- MR_High = Valid_Pivot1_High;
- for ix = barnumber[0] - Valid_Pivot1_HighBar downto 1 begin
- MR_High = maxlist(high[ix],MR_High);
- end;
- MR_High = maxlist(PrevHigh,MR_High);
- end;
- // If the last valid swing pivot low today was broken calculate the lowest price that occurred after the break
- if Pivot1_LowBreakBar = Valid_Pivot1_LowBar and Valid_Pivot1_LowBar >= NewDayBarNum then begin
- MR_Low = Valid_Pivot1_Low;
- for ix = barnumber[0] - Valid_Pivot1_LowBar downto 1 begin
- MR_Low = minlist(Low[ix],MR_Low);
- end;
- MR_Low = minlist(PrevLow,MR_Low);
- end;
- // If no valid pivot high today then use HighOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_Pivot1_HighBar < NewDayBarNum and MarketPosition=-1 then
- Pivot1_HighRev = HighOfDay + CalculateEntrySlack(HighOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot high was broken calculate the highest price that occurred after the break to reverse a short
- else if Pivot1_HighBreakBar = Valid_Pivot1_HighBar and MarketPosition=-1 then
- Pivot1_HighRev=MR_High + CalculateEntrySlack(MR_High, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot1_HighBar >= NewDayBarNum then
- Pivot1_HighRev = Valid_Pivot1_High + CalculateEntrySlack(Valid_Pivot1_High, Entry_Slack_ATR)
- else
- Pivot1_HighRev = 0;
- // If no valid pivot low today then use LowOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_Pivot1_LowBar < NewDayBarNum and MarketPosition=1 then
- Pivot1_LowRev = LowOfDay - CalculateEntrySlack(LowOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot low was broken calculate the lowest price that occurred after the break to reverse a long
- else if Pivot1_LowBreakBar = Valid_Pivot1_LowBar and MarketPosition=1 then
- Pivot1_LowRev = MR_Low - CalculateEntrySlack(MR_Low, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot1_LowBar >= NewDayBarNum then
- Pivot1_LowRev = Valid_Pivot1_Low - CalculateEntrySlack(Valid_Pivot1_Low, Entry_Slack_ATR)
- else
- Pivot1_LowRev = 0;
- end;
- #endregion
- //**********************************************************************************************//
- #region Pivot 2
- // vars:
- // Last_Pivot2_High(0),
- // Last_Pivot2_Low(0),
- // Last_Pivot2_HighBar(0),
- // Last_Pivot2_LowBar(0),
- // Exit_Pivot2_High(0),
- // Exit_Pivot2_Low(0),
- // Pivot2_HighRev(0),
- // Pivot2_LowRev(0),
- // MR_High2(0),
- // MR_Low2(0),
- // intrabarpersist Exit_Pivot2_High_CheckRight(false),
- // intrabarpersist Exit_Pivot2_Low_CheckRight(false),
- // intrabarpersist Valid_Pivot2_High(0),
- // intrabarpersist Valid_Pivot2_Low(0),
- // intrabarpersist Pivot2_High_RightConfirmBar(0),
- // intrabarpersist Pivot2_Low_RightConfirmBar(0),
- // NewValid_Pivot2_High(false),
- // NewValid_Pivot2_Low(false),
- // intrabarpersist Pivot2_High_EntryPr(0),
- // intrabarpersist Pivot2_Low_EntryPr(0),
- // LeftPct(0);
- Pivot2_ER_allow_temp = Pivot2_Entry_____________ONOFF =1 and Pivot2_TrailingReversal=1;
- if Pivot2_ER_allow_temp then begin
- NewValid_Pivot2_High = false;
- NewValid_Pivot2_Low = false;
- // Must wait till close of bar to confirm pivots
- //if PivotHighVSBar( 1, high, Pivot2_High_Left_Strength, Pivot2_High_Right_Strength, Pivot2_High_Right_Strength + 1 ) <> -1 and
- if ( BarComplete ) then begin
- if AVPPivotHighVSBar(
- high,
- iff(Pivot2_ER_allow_temp and BarComplete, Pivot2_High_Left_Strength, 0),
- iff(Pivot2_ER_allow_temp and BarComplete, Pivot2_High_Right_Strength, 0),
- iff(Pivot2_ER_allow_temp and BarComplete, MaxBarsBack, 1)
- ) <> -1 then begin
- Last_Pivot2_High = high[Pivot2_High_Right_Strength];
- Last_Pivot2_HighBar = barnumber[Pivot2_High_Right_Strength];
- // Get left percent
- // There may not be a valid pivot low, in that case use low of day for DT or low of chart for swing trade
- if Last_Pivot2_High<>0 then begin
- if TradeOnlySameDay then begin
- LeftPct = iff( Valid_Pivot2_LowBar < NewDayBarNum,
- (Last_Pivot2_High - LowOfDay) / Last_Pivot2_High,
- (Last_Pivot2_High - Valid_Pivot2_Low) / Last_Pivot2_High
- );
- end
- else begin
- LeftPct = iff( Valid_Pivot2_LowBar = 0,
- (Last_Pivot2_High - LowOfChart) / Last_Pivot2_High,
- (Last_Pivot2_High - Valid_Pivot2_Low) / Last_Pivot2_High
- );
- end;
- end;
- // The pivot is valid only, if the pivot is x% away from the opposite pivot
- // OR if this is higher than the last valid swing pivot high
- if LeftPct > Pivot2_High_PctLeftFilter * 0.01 or Last_Pivot2_High > Exit_Pivot2_High then begin
- Exit_Pivot2_High = Last_Pivot2_High;
- Exit_Pivot2_HighBar = Last_Pivot2_HighBar;
- Valid_Pivot2_High = Exit_Pivot2_High;
- Valid_Pivot2_HighBar = Exit_Pivot2_HighBar;
- //Exit_Pivot2_High_CheckRight = true;
- NewValid_Pivot2_High = true;
- end;
- end;
- //if PivotLowVSBar( 1, low, Pivot2_Low_Left_Strength, Pivot2_Low_Right_Strength, Pivot2_Low_Right_Strength + 1 ) <> -1 and
- if AVPPivotLowVSBar(
- low,
- iff(Pivot2_ER_allow_temp and BarComplete, Pivot2_Low_Left_Strength, 0),
- iff(Pivot2_ER_allow_temp and BarComplete, Pivot2_Low_Right_Strength, 0),
- iff(Pivot2_ER_allow_temp and BarComplete, MaxBarsBack, 1)
- ) <> -1 then begin
- Last_Pivot2_Low = low[Pivot2_Low_Right_Strength];
- Last_Pivot2_LowBar = barnumber[Pivot2_Low_Right_Strength];
- // Get left percent
- // There may not be a valid pivot high, in that case use high of day for DT or high of chart for swing trade
- if Last_Pivot2_Low<>0 then begin
- if TradeOnlySameDay then begin
- LeftPct = iff( Valid_Pivot2_HighBar < NewDayBarNum,
- (HighOfDay - Last_Pivot2_Low) / Last_Pivot2_Low,
- (Valid_Pivot2_High - Last_Pivot2_Low) / Last_Pivot2_Low
- );
- end
- else begin
- LeftPct = iff( Valid_Pivot2_HighBar = 0,
- (HighOfChart - Last_Pivot2_Low) / Last_Pivot2_Low,
- (Valid_Pivot2_High - Last_Pivot2_Low) / Last_Pivot2_Low
- );
- end;
- end;
- // The pivot is valid only, if the pivot is:
- // x% away from the opposite pivot
- // lowest than the last valid swing pivot low
- if Last_Pivot2_Low<>0 and (Last_Pivot2_High - Last_Pivot2_Low) / Last_Pivot2_Low > Pivot2_Low_PctLeftFilter * 0.01 or Last_Pivot2_Low < Exit_Pivot2_Low then begin
- Exit_Pivot2_Low = Last_Pivot2_Low;
- Exit_Pivot2_LowBar = Last_Pivot2_LowBar;
- Valid_Pivot2_Low = Exit_Pivot2_Low;
- Valid_Pivot2_LowBar = Exit_Pivot2_LowBar;
- //Exit_Pivot2_Low_CheckRight = true;
- NewValid_Pivot2_Low = true;
- ////_PRINT("NewValid_Pivot2_Low");
- end;
- end;
- end;
- // Reset Pivot 2
- if IsFirstBarOfDay and PrevBarStatus=2 and TradeOnlySameDay then begin
- Pivot2_High_EntryOK = false;
- Pivot2_Low_EntryOK = false;
- end;
- // Pivot 2 does not check right. Instead if Pivot2_High_PctRightFilter is non-zero then this becomes the
- // entry price if it is below the calculated entry.
- if NewValid_Pivot2_High then begin
- Pivot2_High_EntryOK = true;
- value1= tt_lowest(low,Pivot2_Low_Right_Strength, Pivot2_Entry_____________ONOFF=1 or Pivot2_TrailingReversal=1);
- Pivot2_High_EntryPr = value1 - CalculateEntrySlack(value1, Entry_Slack_ATR);
- if Pivot2_High_PctRightFilter > 0 and Valid_Pivot2_High * (1-Pivot2_High_PctRightFilter * 0.01) < Pivot2_High_EntryPr then
- Pivot2_High_EntryPr = Round(Valid_Pivot2_High * (1-Pivot2_High_PctRightFilter * 0.01),2);
- end;
- if NewValid_Pivot2_Low then begin
- Pivot2_Low_EntryOK = true;
- Value1 = tt_highest(high,Pivot2_High_Right_Strength, Pivot2_Entry_____________ONOFF=1 or Pivot2_TrailingReversal=1);
- Pivot2_Low_EntryPr = Value1 + CalculateEntrySlack( Value1 , Entry_Slack_ATR);
- if Pivot2_Low_PctRightFilter > 0 and Valid_Pivot2_Low * (1+Pivot2_Low_PctRightFilter * 0.01) > Pivot2_Low_EntryPr then
- Pivot2_Low_EntryPr = Round(Valid_Pivot2_Low * (1+Pivot2_Low_PctRightFilter * 0.01),2);
- end;
- // If the last valid swing pivot high today was broken calculate the highest price that occurred after the break
- if Pivot2_HighBreakBar = Valid_Pivot2_HighBar and Valid_Pivot2_HighBar >= NewDayBarNum then begin
- MR_High2 = Valid_Pivot2_High;
- for ix = barnumber[0] - Valid_Pivot2_HighBar downto 1 begin
- MR_High2 = maxlist(high[ix],MR_High2);
- end;
- MR_High2 = maxlist(PrevHigh,MR_High2);
- end;
- // If the last valid swing Pivot low today was broken calculate the lowest price that occurred after the break
- if Pivot2_LowBreakBar = Valid_Pivot2_LowBar and Valid_Pivot2_LowBar >= NewDayBarNum then begin
- MR_Low2 = Valid_Pivot2_Low;
- for ix = barnumber[0] - Valid_Pivot2_LowBar downto 1 begin
- MR_Low2 = minlist(Low[ix],MR_Low2);
- end;
- MR_Low2 = minlist(PrevLow,MR_Low2);
- end;
- // If no valid pivot high today then use HighOfDay
- if TradeOnlySameDay and Valid_Pivot2_HighBar < NewDayBarNum and MarketPosition=-1 then
- Pivot2_HighRev = HighOfDay + CalculateEntrySlack(HighOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot high was broken calculate the highest price that occurred after the break to reverse a short
- else if Pivot2_HighBreakBar = Valid_Pivot2_HighBar and MarketPosition=-1 then
- Pivot2_HighRev=MR_High2 + CalculateEntrySlack(MR_High2, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot2_HighBar >= NewDayBarNum then
- Pivot2_HighRev = Valid_Pivot2_High + CalculateEntrySlack(Valid_Pivot2_High, Entry_Slack_ATR)
- else
- Pivot2_HighRev = 0;
- // If no valid pivot low today then use LowOfDay
- if TradeOnlySameDay and Valid_Pivot2_LowBar < NewDayBarNum and MarketPosition=1 then
- Pivot2_LowRev = LowOfDay - CalculateEntrySlack(LowOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot low was broken calculate the lowest price that occurred after the break to reverse a long
- else if Pivot2_LowBreakBar = Valid_Pivot2_LowBar and MarketPosition=1 then
- Pivot2_LowRev=MR_Low2 - CalculateEntrySlack(MR_Low2, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot2_LowBar >= NewDayBarNum then
- Pivot2_LowRev = Valid_Pivot2_Low - CalculateEntrySlack(Valid_Pivot2_Low, Entry_Slack_ATR)
- else
- Pivot2_LowRev = 0;
- end;
- #endregion
- //**********************************************************************************************//
- #region Pivot 3
- // vars:
- // Pivot3_HAColor(0),
- // Pivot3_HASignalUp(false),
- // Pivot3_HASignalDown(false),
- // Last_Pivot3_High(0), Last_Pivot3_HighOffset(0), Last_Pivot3_HighBar(0),
- // Last_Pivot3_Low(0), Last_Pivot3_LowOffset(0), Last_Pivot3_LowBar(0),
- // Pivot3_High_LeftFilter_Amt(0), Pivot3_Low_LeftFilter_Amt(0),
- // Pivot3_High_RightFilter_Amt(0), Pivot3_Low_RightFilter_Amt(0),
- // Exit_Pivot3_High(0), Exit_Pivot3_HighOffset(0), Exit_Pivot3_High_CheckRight(false), //Exit_Pivot3_HighBar(0),
- // Exit_Pivot3_Low(0), Exit_Pivot3_LowOffset(0), Exit_Pivot3_Low_CheckRight(false), //Exit_Pivot3_LowBar(0),
- // Valid_Pivot3_High(0),
- // //Valid_Pivot3_HighBar(0),
- // Valid_Pivot3_Low(0),
- // Pivot3_HighRev(0),
- // Pivot3_LowRev(0),
- // Pivot3_HAGreen_High(0),
- // Pivot3_HAGreen_HighBar(0),
- // Pivot3_HARed_Low(0),
- // Pivot3_HARed_LowBar(0),
- // LeftBarsOK(false),
- // RightBarsOK(false)
- // ;
- if Pivot3_Entry_____________ONOFF = 1 then begin
- Value1 = AVP_HeikinAshi3(
- iff(Pivot3_Entry_____________ONOFF = 1, Pivot3_HA_CompBars, 0),
- iff(Pivot3_Entry_____________ONOFF = 1, Pivot3_HA_SmoothHA, 0),
- iff(Pivot3_Entry_____________ONOFF = 1, Pivot3_HA_SmoothAvgType,0),
- iff(Pivot3_Entry_____________ONOFF = 1, Pivot3_HA_SmoothLength, 1),
- Pivot3_debug_Show_HA_VISUALS,
- Pivot3_HAColor,
- Pivot3_HASignalUp,
- Pivot3_HASignalDown
- );
- //reset on new day
- Pivot3_HA_reset = (TradeOnlySameDay and IsFirstTickOfDay);
- _HA_Change_up = (Pivot3_HASignalUp and BarComplete);
- _HA_Change_down = (Pivot3_HASignalDown and BarComplete);
- // Update Red Low
- // This will include the confirmation candle
- if (Pivot3_HAColor=red or _HA_Change_up) and (low < Pivot3_HARed_Low or (Pivot3_HA_reset or Pivot3_HARed_Low = 0) ) then begin
- Pivot3_HARed_Low = low;
- Pivot3_HARed_LowBar = barnumber;
- end;
- // Update Green High
- // This will include the confirmation candle
- if (Pivot3_HAColor=green or _HA_Change_down) and (high > Pivot3_HAGreen_High or (Pivot3_HA_reset or Pivot3_HAGreen_High = 0) ) then begin
- Pivot3_HAGreen_High = high;
- Pivot3_HAGreen_HighBar = barnumber;
- end;
- // Pivot High: Change of trend down
- if BarComplete then begin
- If (Pivot3_HASignalDown[maxlist(0,Pivot3_High_Right_Strength-1)] ) then begin
- // Lookback for high
- //value1=Extremes( high, Pivot3_High_Look_Back, 1, Last_Pivot3_High, Last_Pivot3_HighOffset ) ;
- //Last_Pivot3_HighBar = barnumber[Last_Pivot3_HighOffset];
- if Pivot3_HAGreen_High > 0 then begin
- Last_Pivot3_High = Pivot3_HAGreen_High;
- Last_Pivot3_HighBar = Pivot3_HAGreen_HighBar;
- // Check left bars
- LeftBarsOK = true;
- for ix = currentbar-Pivot3_HAGreen_HighBar+1 to currentbar-Pivot3_HAGreen_HighBar + Pivot3_High_Left_Strength begin
- if Pivot3_HAColor[ix] <> green then
- LeftBarsOK = false;
- end;
- // Check right bars
- RightBarsOK = currentbar-Pivot3_HAGreen_HighBar >= Pivot3_High_Right_Strength;
- // Filter amounts
- Pivot3_High_LeftFilter_Amt = Last_Pivot3_High * Pivot3_High_PctLeftFilter * 0.01;
- // Get left percent
- // There may not be a valid pivot low, in that case use: low of day (for DT) or low of chart (for swing trade)
- if TradeOnlySameDay then begin
- value1 = iff(Valid_Pivot3_LowBar <= NewDayBarNum, LowOfDay, Valid_Pivot3_Low);
- end
- else begin
- value1 = iff(Valid_Pivot3_LowBar = 0, LowOfChart, Valid_Pivot3_Low);
- end;
- LeftAmt = Last_Pivot3_High - value1;
- // The pivot is valid only, if the pivot is x% away from the opposite pivot
- // Exception if this is higher than the last valid swing pivot high
- if LeftBarsOK and RightBarsOK and (LeftAmt > Pivot3_High_LeftFilter_Amt or Last_Pivot3_High > Exit_Pivot3_High) then begin
- Exit_Pivot3_High = Last_Pivot3_High;
- Exit_Pivot3_HighBar = Last_Pivot3_HighBar;
- Exit_Pivot3_High_CheckRight = true;
- end;
- end;
- Pivot3_HARed_Low = low;
- Pivot3_HARed_LowBar = barnumber;
- end;
- end;
- // Pivot Low: Change of trend up
- if BarComplete then begin
- If (Pivot3_HASignalUp[maxlist(0,Pivot3_Low_Right_Strength-1)] ) then begin
- // Lookback for low
- //value1=Extremes( low, Pivot3_Low_Look_Back, -1, Last_Pivot3_Low, Last_Pivot3_LowOffset ) ;
- //Last_Pivot3_LowBar = barnumber[Last_Pivot3_LowOffset];
- if Pivot3_HARed_Low > 0 then begin
- Last_Pivot3_Low = Pivot3_HARed_Low;
- Last_Pivot3_LowBar = Pivot3_HARed_LowBar;
- // Check left bars
- LeftBarsOK = true;
- for ix = currentbar-Pivot3_HARed_LowBar+1 to currentbar-Pivot3_HARed_LowBar + Pivot3_Low_Left_Strength begin
- if Pivot3_HAColor[ix] <> red then
- LeftBarsOK = false;
- end;
- // Check right bars
- RightBarsOK = currentbar-Pivot3_HARed_LowBar >= Pivot3_Low_Right_Strength;
- // Filter amounts
- Pivot3_Low_LeftFilter_Amt = Last_Pivot3_Low * Pivot3_Low_PctLeftFilter * 0.01;
- // Get left percent
- // There may not be a valid pivot high, in that case use: high of day (for DT) or high of chart (for swing trade)
- if TradeOnlySameDay then begin
- value1 = iff(Valid_Pivot3_HighBar < NewDayBarNum, HighOfDay, Valid_Pivot3_High);
- end
- else begin
- value1 = iff(Valid_Pivot3_HighBar = 0, HighOfChart, Valid_Pivot3_High);
- end;
- LeftAmt = value1 - Last_Pivot3_Low;
- // The pivot is valid only, if the pivot is x% away from the opposite pivot
- // Exception if this is Lower than the last valid swing pivot Low
- if LeftBarsOK and RightBarsOK and (LeftAmt > Pivot3_Low_LeftFilter_Amt or Last_Pivot3_Low < Exit_Pivot3_Low) then begin
- Exit_Pivot3_Low = Last_Pivot3_Low;
- Exit_Pivot3_LowBar = Last_Pivot3_LowBar;
- Exit_Pivot3_Low_CheckRight = true;
- end;
- end;
- Pivot3_HAGreen_High = high;
- Pivot3_HAGreen_HighBar = barnumber;
- end;
- end;
- // Filter amounts
- Pivot3_High_RightFilter_Amt = Exit_Pivot3_High * Pivot3_High_PctRightFilter * 0.01;
- Pivot3_Low_RightFilter_Amt = Exit_Pivot3_Low * Pivot3_Low_PctRightFilter * 0.01;
- // Stop checking for %Filter Right if price breaks the pivot high
- if Exit_Pivot3_High_CheckRight and high > Exit_Pivot3_High then
- Exit_Pivot3_High_CheckRight = false;
- if Exit_Pivot3_Low_CheckRight and low < Exit_Pivot3_Low then
- Exit_Pivot3_Low_CheckRight = false;
- // Check %Filter Right
- if Exit_Pivot3_High_CheckRight and close <= Exit_Pivot3_High - Pivot3_High_RightFilter_Amt then begin
- Valid_Pivot3_High = Exit_Pivot3_High;
- Valid_Pivot3_HighBar = Exit_Pivot3_HighBar;
- Exit_Pivot3_High_CheckRight = false;
- end;
- if Exit_Pivot3_Low_CheckRight and close >= Exit_Pivot3_Low + Pivot3_Low_RightFilter_Amt then begin
- Valid_Pivot3_Low = Exit_Pivot3_Low;
- Valid_Pivot3_LowBar = Exit_Pivot3_LowBar;
- Exit_Pivot3_Low_CheckRight = false;
- end;
- // If the last valid swing pivot high today was broken calculate the highest price that occurred after the break
- if Pivot3_HighBreakBar = Valid_Pivot3_HighBar and Valid_Pivot3_HighBar >= NewDayBarNum then begin
- MR_High = Valid_Pivot3_High;
- for ix = barnumber[0] - Valid_Pivot3_HighBar downto 1 begin
- MR_High = maxlist(high[ix],MR_High);
- end;
- MR_High = maxlist(PrevHigh,MR_High);
- end;
- // If the last valid swing pivot low today was broken calculate the lowest price that occurred after the break
- if Pivot3_LowBreakBar = Valid_Pivot3_LowBar and Valid_Pivot3_LowBar > NewDayBarNum then begin
- MR_Low = Valid_Pivot3_Low;
- for ix = barnumber[0] - Valid_Pivot3_LowBar downto 1 begin
- MR_Low = minlist(Low[ix],MR_Low);
- end;
- MR_Low = minlist(PrevLow,MR_Low);
- end;
- // If no valid pivot high today then use HighOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_Pivot3_HighBar < NewDayBarNum and MarketPosition=-1 then
- Pivot3_HighRev = HighOfDay + CalculateEntrySlack(HighOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot high was broken calculate the highest price that occurred after the break to reverse a short
- else if Pivot3_HighBreakBar = Valid_Pivot3_HighBar and MarketPosition=-1 then
- Pivot3_HighRev=MR_High + CalculateEntrySlack(MR_High, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot3_HighBar >= NewDayBarNum then
- Pivot3_HighRev = Valid_Pivot3_High + CalculateEntrySlack(Valid_Pivot3_High, Entry_Slack_ATR)
- else
- Pivot3_HighRev = 0;
- // If no valid pivot low today then use LowOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_Pivot3_LowBar <= NewDayBarNum and MarketPosition=1 then
- Pivot3_LowRev = LowOfDay - CalculateEntrySlack(LowOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot low was broken calculate the lowest price that occurred after the break to reverse a long
- else if MR_Low > 0 and Pivot3_LowBreakBar = Valid_Pivot3_LowBar and MarketPosition=1 then
- Pivot3_LowRev=MR_Low - CalculateEntrySlack(MR_Low, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_Pivot3_LowBar > NewDayBarNum then
- Pivot3_LowRev = Valid_Pivot3_Low - CalculateEntrySlack(Valid_Pivot3_Low, Entry_Slack_ATR)
- else
- Pivot3_LowRev = 0;
- end;
- #endregion
- //**********************************************************************************************//
- #region HA Pivots
- // vars:
- // HAColor(0),
- // HASignalUp(false),
- // HASignalDown(false),
- // HARed_Low(0),
- // HARed_LowBar(0),
- // HAGreen_High(0),
- // HAGreen_HighBar(0),
- // Valid_HAPiv_High(0), Valid_HAPiv_HighBar(0), Valid_HAPiv_Low(0), Valid_HAPiv_LowBar(0),
- // HAPiv_HighBreakBar(0),
- // HAPiv_LowBreakBar(0),
- // HAPiv_HighRev(0),
- // HAPiv_LowRev(0);
- if HA_Entry_____________ONOFF <> 0 then begin
- value1 = AVP_HeikinAshi3(
- iff(HA_Entry_____________ONOFF = 0, 0, HA_CompBars),
- iff(HA_Entry_____________ONOFF = 0, 0, HA_SmoothHA),
- iff(HA_Entry_____________ONOFF = 0, 0, HA_SmoothAvgType),
- iff(HA_Entry_____________ONOFF = 0, 1, HA_SmoothLength),
- false,
- HAColor,
- HASignalUp,
- HASignalDown
- );
- _HA_Change_up = (HASignalUp and BarComplete);
- _HA_Change_down= (HASignalDown and BarComplete);
- // Update Red Low
- // This will include the confirmation candle
- if (HAColor=red or _HA_Change_up) and
- (low < HARed_Low or HARed_Low = 0) then begin
- HARed_Low = low;
- HARed_LowBar = barnumber;
- end;
- // Update Green High
- // This will include the confirmation candle
- if (HAColor=green or _HA_Change_down ) and
- (high > HAGreen_High or HAGreen_High = 0) then begin
- HAGreen_High = high;
- HAGreen_HighBar = barnumber;
- end;
- // Pivot High: Change of trend down
- if _HA_Change_down then begin
- // Lookback for high
- if HAGreen_High > 0 then begin
- Valid_HAPiv_High = HAGreen_High;
- Valid_HAPiv_HighBar = HAGreen_HighBar;
- end;
- HARed_Low = low;
- HARed_LowBar = barnumber;
- end;
- // Pivot Low: Change of trend up
- if _HA_Change_up then begin
- // Lookback for low
- if HARed_Low > 0 then begin
- Valid_HAPiv_Low = HARed_Low;
- Valid_HAPiv_LowBar = HARed_LowBar;
- end;
- HAGreen_High = high;
- HAGreen_HighBar = barnumber;
- end;
- // If the last valid swing pivot high today was broken calculate the highest price that occurred after the break
- if HAPiv_HighBreakBar = Valid_HAPiv_HighBar and Valid_HAPiv_HighBar >= NewDayBarNum then begin
- MR_High = Valid_HAPiv_High;
- for ix = barnumber[0] - Valid_HAPiv_HighBar downto 1 begin
- MR_High = maxlist(high[ix],MR_High);
- end;
- MR_High = maxlist(PrevHigh,MR_High);
- end;
- // If the last valid swing pivot low today was broken calculate the lowest price that occurred after the break
- if HAPiv_LowBreakBar = Valid_HAPiv_LowBar and Valid_HAPiv_LowBar >= NewDayBarNum then begin
- MR_Low = Valid_HAPiv_Low;
- for ix = barnumber[0] - Valid_HAPiv_LowBar downto 1 begin
- MR_Low = minlist(Low[ix],MR_Low);
- end;
- MR_Low = minlist(PrevLow,MR_Low);
- end;
- // If no valid pivot high today then use HighOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_HAPiv_HighBar < NewDayBarNum and MarketPosition=-1 then
- HAPiv_HighRev = HighOfDay + CalculateEntrySlack(HighOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot high was broken calculate the highest price that occurred after the break to reverse a short
- else if MR_High > 0 and HAPiv_HighBreakBar = Valid_HAPiv_HighBar and MarketPosition=-1 then
- HAPiv_HighRev=MR_High + CalculateEntrySlack(MR_High, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_HAPiv_HighBar >= NewDayBarNum then
- HAPiv_HighRev = Valid_HAPiv_High + CalculateEntrySlack(Valid_HAPiv_High, Entry_Slack_ATR)
- else
- HAPiv_HighRev = 0;
- // If no valid pivot low today then use LowOfDay
- // Only for reversals
- if TradeOnlySameDay and Valid_HAPiv_LowBar < NewDayBarNum and MarketPosition=1 then
- HAPiv_LowRev = LowOfDay - CalculateEntrySlack(LowOfDay, Entry_Slack_ATR)
- // Update 9/22/16
- // If the last valid swing pivot low was broken calculate the lowest price that occurred after the break to reverse a long
- else if HAPiv_LowBreakBar = Valid_HAPiv_LowBar and MarketPosition=1 then
- HAPiv_LowRev=MR_Low - CalculateEntrySlack(MR_Low, Entry_Slack_ATR)
- else if (not TradeOnlySameDay) or Valid_HAPiv_LowBar >= NewDayBarNum then
- HAPiv_LowRev = Valid_HAPiv_Low - CalculateEntrySlack(Valid_HAPiv_Low, Entry_Slack_ATR)
- else
- HAPiv_LowRev = 0;
- end;
- #endregion
- // ########################################### Heikin Ashi orders ##############################################
- #region Heikin Ashi Entries
- // vars:
- // HAUp_Entry(false),
- // HADn_Entry(false),
- // HAUp_Price(0),
- // HADn_Price(0);
- // vars:
- // HA_Entry2_LE(false),
- // HA_Entry2_SE(false),
- // intrabarpersist HA_Entry2_Candles_LE(0),
- // intrabarpersist HA_Entry2_Candles_SE(0);
- // Vars : isNewSess(false), inBreakTime(false);
- isNewSess = TradeOnlySameDay and SessStartTime <> -1 and SessEndTime <> -1 and (time[1] <= SessStartTime or IsFirstBarOfDay);
- inBreakTime = TradeOnlySameDay and BreakStartTime <> -1 and BreakEndTime <> -1 and (time[1] > BreakStartTime and time[1] <= BreakEndTime);
- if HA_Entry_____________ONOFF = 1 then begin
- // ##### HA type 1
- if (HA_EntryType = 1) then begin
- // AVP_HeikinAshi3 called previously
- // Check for break of last pivot high
- if high[1] >= HAPiv_HighRev[1] then
- HAPiv_HighBreakBar = Valid_HAPiv_HighBar[1];
- // Break on current bar when long also needs to be a break bar
- if high >= HAPiv_HighRev and MarketPosition=1 then
- HAPiv_HighBreakBar = Valid_HAPiv_HighBar;
- // Check for break of last pivot low
- if low[1] <= HAPiv_LowRev[1] then
- HAPiv_LowBreakBar = Valid_HAPiv_LowBar[1];
- // Break on current bar when short also needs to be a break bar
- if low <= HAPiv_LowRev and MarketPosition=-1 then
- HAPiv_LowBreakBar = Valid_HAPiv_LowBar;
- // First bar
- if isNewSess then begin
- HAUp_Entry = false;
- HADn_Entry = false;
- end
- // Second bar
- else if HA_UseFirstBarBreak = 1 and time[1] > SessStartTime and isNewSess[1] then begin
- if HAColor[1] = green then begin
- HAUp_Entry = true;
- HADn_Entry = false;
- HAUp_Price = high[1] + CalculateEntrySlack(high[1], Entry_Slack_ATR);
- end
- else if HAColor[1] = red then begin
- HAUp_Entry = false;
- HADn_Entry = true;
- HADn_Price = low[1] - CalculateEntrySlack(low[1], Entry_Slack_ATR);
- end;
- end
- // Break
- else if inBreakTime then begin
- HAUp_Entry = false;
- HADn_Entry = false;
- end
- // Second bar after break
- else if HA_UseFirstBarBreak = 1 and inBreakTime[1] then begin
- if HAColor[1] = green then begin
- HAUp_Entry = true;
- HADn_Entry = false;
- HAUp_Price = high[1] + CalculateEntrySlack(high[1], Entry_Slack_ATR);
- end
- else if HAColor[1] = red then begin
- HADn_Entry = true;
- HAUp_Entry = false;
- HADn_Price = low[1] - CalculateEntrySlack(low[1], Entry_Slack_ATR);
- end;
- end
- // Normal, should not consider prior dates for signal when TradeOnlySameDay
- else if (not TradeOnlySameDay) or (time[2] > SessStartTime and date[1]=date[2]) then begin
- if HASignalUp[1] then begin
- HAUp_Entry = true;
- HADn_Entry = false;
- HAUp_Price = high[1] + CalculateEntrySlack(high[1], Entry_Slack_ATR);
- end;
- if HASignalDown[1] then begin
- HADn_Entry = true;
- HAUp_Entry = false;
- HADn_Price = low[1] - CalculateEntrySlack(low[1], Entry_Slack_ATR);
- end;
- end;
- // if TradeOnlySameDay and (IsFirstBarOfDay or date[1] <> date[2])
- if HA_LEBar = barnumber[0] then HAUp_Entry = false;
- if HA_SEBar = barnumber[0] then HADn_Entry = false;
- // Entries (if allowed)
- if TradeOK_ORB_ed then begin
- // Entry is triggered when a candle goes above highest price of signal candle
- if HAUp_Entry then
- If (HA_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) then
- If permit_LONG then
- order_Entry(true, HAUp_Price, "LONG", RT, HAUp_Price, "LE HA", HA_order_type);
- // Entry is triggered when a candle goes below lowest price of signal candle
- if HADn_Entry then
- If (HA_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) then
- If permit_SHORT then
- order_Entry(true, HADn_Price, "SHORT", RT, HADn_Price, "SE HA", HA_order_type);
- end
- // Exit (if no new entries allowed)
- else begin
- if HAUp_Entry then
- If (HA_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX HA", 0, HAUp_Price);
- if HADn_Entry then
- If (HA_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) then
- order_Exit("LX HA", 0, HADn_Price);
- end;
- // HA Pivot reversal
- if HA_UsePivReversalEntry = 1 then begin
- if MarketPosition=1 then begin
- //Rev entry
- if LastEntry.Contains("LE HA ") and Valid_HAPiv_Low > 0 then begin
- if
- (HA_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry ) and
- (HA_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit )
- and permit_SHORT then
- order_Entry(false, Valid_HAPiv_Low, "SHORT", RT, Valid_HAPiv_Low, "SE HA Rev", HA_order_type)
- else If (HA_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) then
- order_Exit("LX HA Exit", 0, Valid_HAPiv_Low);
- DrawLine(TL_HAPivRevStop,TXT_HAPivRevStop,NumToStr(Valid_HAPiv_Low,2),Valid_HAPiv_Low,HAPivRevStop_Color,"HAPivRev Stop");
- end;
- //RevExit
- if LastEntry.Contains("LE HA RevExit") and HAPiv_LowRev > 0 then
- If (HA_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) then
- order_Exit("LX HA RevExit", 0, HAPiv_LowRev);
- end;
- if MarketPosition=-1 then begin
- //Rev entry
- if LastEntry.Contains("SE HA ") and Valid_HAPiv_High > 0 then begin
- if
- (HA_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry ) and
- (HA_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit )
- and permit_LONG then
- order_Entry(false, Valid_HAPiv_High, "LONG", RT, Valid_HAPiv_High, "LE HA Rev", HA_order_type)
- else If (HA_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX HA Exit", 0, Valid_HAPiv_High);
- DrawLine(TL_HAPivRevStop,TXT_HAPivRevStop,NumToStr(Valid_HAPiv_High,2),Valid_HAPiv_High,HAPivRevStop_Color,"HAPivRev Stop");
- end;
- //RevExit
- if LastEntry.Contains("SE HA Rev ") and HAPiv_HighRev > 0 then
- If (HA_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX HA RevExit", 0, HAPiv_HighRev);
- end;
- end;
- end;
- // ##x Heikin-Ashi 2 orders ##
- if HA_EntryType = 2 then begin
- if TradeOK_ORB_ed then begin
- HA_Entry2_LE = false;
- HA_Entry2_SE = false;
- if BarComplete then begin
- if HAColor = green then HA_Entry2_Candles_LE += 1;
- if HAColor = red then HA_Entry2_Candles_SE += 1;
- if HASignalUp and
- // Don't allow signal if DT and prior bar was on a different date
- ((not TradeOnlySameDay) or (time[1] >= SessStartTime and date=date[1])) then
- begin
- if HA_Entry2_Candles <= 1 then
- HA_Entry2_LE = true;
- HA_Entry2_Candles_LE = 1;
- end
- else if HA_Entry2_Candles > 1 then begin
- if HA_Entry2_Candles_LE = HA_Entry2_Candles then
- HA_Entry2_LE = true;
- end;
- if HASignalDown and
- // Don't allow signal if DT and prior bar was on a different date
- ((not TradeOnlySameDay) or (time[1] >= SessStartTime and date=date[1])) then
- begin
- if HA_Entry2_Candles <= 1 then HA_Entry2_SE = true;
- HA_Entry2_Candles_SE = 1;
- end
- else if HA_Entry2_Candles > 1 then begin
- if HA_Entry2_Candles_SE = HA_Entry2_Candles then
- HA_Entry2_SE = true;
- end;
- end;
- // Entry is triggered at close of bar where Heikin Ashi signal occurs
- if HA_Entry2_LE then
- If (HA_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) then
- if permit_LONG then
- order_Entry(true, close, "LONG", RT, close, "LE HA2", HA_2_order_type);
- if HA_Entry2_SE then
- // Entry is triggered at close of bar where Heikin Ashi signal occurs
- If (HA_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) then
- if permit_SHORT then
- order_Entry(true, close, "SHORT", RT, close, "SE HA2", HA_2_order_type);
- end;
- end;
- end;
- #endregion
- // #####################################################################################################################
- // ############################################## Pivot1 orders ################################################
- #region Pivot1 Exit / Reversal
- if Pivot1_Exit______________ONOFF = 1 then begin
- // Check for break of last pivot high
- if high[1] >= Pivot1_HighRev[1] then
- Pivot1_HighBreakBar = Valid_Pivot1_HighBar[1];
- // Check for break of last pivot low
- if low[1] <= Pivot1_LowRev[1] then
- Pivot1_LowBreakBar = Valid_Pivot1_LowBar[1];
- // Break on current bar when short also needs to be a break bar
- if MarketPosition=-1 and low <= Pivot1_LowRev then
- Pivot1_LowBreakBar = Valid_Pivot1_LowBar;
- if Pivot1_TrailingReversal = 1 and TradeOK_ORB_ed then begin
- if MarketPosition=1 and Pivot1_LowRev > 0 and close > Pivot1_LowRev {and Pivot1_LowBreakBar < Valid_Pivot1_LowBar} then begin
- //FirstStop = Pivot1_LowRev * (1 + FirstProtectiveStopPctDistance * 0.01);
- If permit_SHORT and
- (Pivot1_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) and
- (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit ) and
- Pivot1_MA2Filt_Short_Entry_Allow
- then
- order_Entry(false, Pivot1_LowRev, "SHORT", RT, Pivot1_LowRev, "SE Pivot1 Rev", Pivot1_order_type)
- else If (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) then
- order_Exit("LX Pivot1 RevExit", 0, Pivot1_LowRev);
- DrawLine(TL_Pivot1RevStop,TXT_Pivot1RevStop,NumToStr(Pivot1_LowRev,2), Pivot1_LowRev, Pivot1_RevStop_Color,"Pivot1 Stop");
- end;
- if MarketPosition=-1 and Pivot1_HighRev > 0 and close < Pivot1_HighRev {and Pivot1_HighBreakBar < Valid_Pivot1_HighBar} then begin
- //FirstStop = Pivot1_HighRev * (1 - FirstProtectiveStopPctDistance * 0.01);
- If permit_LONG and
- (Pivot1_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) and
- (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit ) and
- Pivot1_MA2Filt_Long_Entry_Allow
- then
- order_Entry(false, Pivot1_HighRev, "LONG", RT, Pivot1_HighRev, "LE Pivot1 Rev", Pivot1_order_type) //buy ("LE Pivot Reversal") LE_Shares shares next bar at Pivot1_HighRev stop
- else If (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX Pivot1 RevExit", 0, Pivot1_HighRev);
- DrawLine(TL_Pivot1RevStop,TXT_Pivot1RevStop,NumToStr(Pivot1_HighRev,2),Pivot1_HighRev,Pivot1_RevStop_Color,"Pivot1 Stop");
- end;
- end
- else begin
- // break of the last trailing pivot high/low as the exit point
- if MarketPosition=1 and Pivot1_LowRev > 0 and close > Pivot1_LowRev then begin
- If (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) then begin
- order_Exit("LX Pivot1 Exit", 0, Pivot1_LowRev);
- DrawLine(TL_Pivot1RevStop,TXT_Pivot1RevStop,NumToStr(Pivot1_LowRev,2),Pivot1_LowRev,Pivot1_RevStop_Color,"Pivot1 Stop");
- end;
- end;
- if MarketPosition=-1 and Pivot1_HighRev > 0 and close < Pivot1_HighRev then begin
- If (Pivot1_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then begin
- order_Exit("SX Pivot1 Exit", 0, Pivot1_HighRev);
- DrawLine(TL_Pivot1RevStop,TXT_Pivot1RevStop,NumToStr(Pivot1_HighRev,2),Pivot1_HighRev,Pivot1_RevStop_Color,"Pivot1 Stop");
- end;
- end;
- end;
- end;
- #endregion
- // ##########
- #region Pivot1 Entries
- if Pivot1_TrailingReversal = 1 and TradeOK_ORB_ed then begin //and (ORB_Entry_____________ONOFF = 0 or NumTradesToday > 0 or SkipORSetup)}
- // Check for break of last pivot high
- if high[1] >= Pivot1_HighRev[1] then
- Pivot1_HighBreakBar = Valid_Pivot1_HighBar[1];
- // Check for break of last pivot low
- if low[1] <= Pivot1_LowRev[1] then
- Pivot1_LowBreakBar = Valid_Pivot1_LowBar[1];
- // Break on current bar also triggers a break bar, provided we don't already have a pivot entry active
- if LE_Pivot1_Entry_Active = false and high >= Pivot1_HighRev then
- Pivot1_HighBreakBar = Valid_Pivot1_HighBar;
- if SE_Pivot1_Entry_Active = false and low <= Pivot1_LowRev then
- Pivot1_LowBreakBar = Valid_Pivot1_LowBar;
- // if ORB_Entry_____________ONOFF is off then the first trade of the day will be triggered by the first break of the first swing pivot high or low instead.
- LE_Pivot1_Entry_Active = false;
- SE_Pivot1_Entry_Active = false;
- if MarketPosition=0 then begin
- // When we first send the entry price must be above the pivot
- // However once entry is activated the order should stay open
- RT_Log("SE Pivot1 Conditions - " +
- " 1:" + iffstring(Pivot1_LowRev > 0,"T","F") +
- " 2:" + iffstring((close > Pivot1_LowRev or SE_Pivot1_Entry_Active),"T","F") +
- " 3:" + iffstring(Pivot1_LowBreakBar < Valid_Pivot1_LowBar,"T","F")
- );
- // When we first send the entry price must be above the pivot
- // However once entry is activated the order should stay open
- if
- Pivot1_LowRev > 0 and
- (close > Pivot1_LowRev or SE_Pivot1_Entry_Active) and
- Pivot1_LowBreakBar < Valid_Pivot1_LowBar and
- Pivot1_MA2Filt_Short_Entry_Allow
- then begin
- //FirstStop = Pivot1_LowRev * (1 + FirstProtectiveStopPctDistance * 0.01);
- If (Pivot1_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) then
- If permit_SHORT then
- SE_Pivot1_Entry_Active = order_Entry(false, Pivot1_LowRev, "SHORT", RT, Pivot1_LowRev, "SE Pivot1", Pivot1_order_type);
- end;
- RT_Log("LE Pivot1 Conditions - " +
- " 1:" + iffstring(Pivot1_HighRev > 0,"T","F") +
- " 2:" + iffstring((close < Pivot1_HighRev or LE_Pivot1_Entry_Active),"T","F") +
- " 3:" + iffstring(Pivot1_HighBreakBar < Valid_Pivot1_HighBar,"T","F")
- );
- // When we first send the entry price must be below the pivot
- // However once entry is activated the order should stay open
- if
- Pivot1_HighRev > 0 and
- (close < Pivot1_HighRev or LE_Pivot1_Entry_Active) and
- Pivot1_HighBreakBar < Valid_Pivot1_HighBar and
- Pivot1_MA2Filt_Long_Entry_Allow
- then begin
- //FirstStop = Pivot1_HighRev * (1 - FirstProtectiveStopPctDistance * 0.01);
- If (Pivot1_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) then begin
- If (permit_LONG) then
- LE_Pivot1_Entry_Active = order_Entry(false, Pivot1_HighRev, "LONG", RT, Pivot1_HighRev, "LE Pivot1", Pivot1_order_type); // at Pivot1_HighRev stop;
- end;
- end;
- end;
- end;
- #endregion
- // #####################################################################################################################
- // ############################################## Pivot2 orders ################################################
- #region Pivot 2 Exit / Reversal
- if Pivot2_Entry_____________ONOFF = 1 or Pivot2_Exit______________ONOFF = 1 then begin
- check_for_exit=false;
- // Turn f Pivot2_Low entry if long position and not Pivot2 or Trade not OK and
- // entry price is broken
- if Pivot2_Low_EntryOK and high >= Pivot2_Low_EntryPr {and
- ((MarketPosition = 1 and LastEntryFilled) or TradeOK_ORB_ed = false or Pivot2_MA1Filt_Long_Entry_Allow=false or NOT permit_LONG)} then
- Pivot2_Low_EntryOK = false;
- // Turn off Pivot2_High entry if short position and not Pivot2 or Trade not OK and
- // entry price is broken
- if Pivot2_High_EntryOK and low <= Pivot2_High_EntryPr {and
- ((MarketPosition = -1 and LastEntryFilled) or TradeOK_ORB_ed = false or Pivot2_MA1Filt_Short_Entry_Allow=false or NOT permit_SHORT)} then
- Pivot2_High_EntryOK = false;
- if high >= Pivot2_HighRev then
- Pivot2_High_EntryOK = false;
- if low <= Pivot2_LowRev then
- Pivot2_Low_EntryOK = false;
- // Check for break of last pivot high
- if high[1] >= Pivot2_HighRev[1] then begin
- Pivot2_HighBreakBar = Valid_Pivot2_HighBar[1];
- end;
- // Check for break of last pivot low
- if low[1] <= Pivot2_LowRev[1] then begin
- Pivot2_LowBreakBar = Valid_Pivot2_LowBar[1];
- end;
- if Pivot2_TrailingReversal = 1 then begin
- If TradeOK_ORB_ed then begin
- if MarketPosition=1 then begin
- // 2 different possibilities
- // 1. A new pivot high is formed and break below the right bars
- // 2. a break of the pivot low
- // New pivot high
- if Pivot2_High_EntryOK and Pivot2_High_EntryPr > 0 and
- (not TradeOnlySameDay or Valid_Pivot2_HighBar > NewDayBarNum)
- then begin
- If permit_SHORT and
- (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) and
- (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) and
- Pivot2_MA1Filt_Short_Entry_Allow
- then
- order_Entry(false, Pivot2_High_EntryPr, "SHORT", RT, Pivot2_High_EntryPr, "SE Pivot2 eRev", Pivot2_order_type)
- else if (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_LONG_EXIT) then
- order_Exit("LX Pivot2 Exit3", 0, Pivot2_High_EntryPr);
- end;
- if Pivot2_LowRev > 0 and close > Pivot2_LowRev then begin
- if permit_SHORT and
- (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) and
- (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit) and
- Pivot2_MA1Filt_Short_Entry_Allow
- then begin
- FirstStop = CalculateFirstStop("SHORT", false, Pivot1_LowRev); //<-------------------------- should there be Pivot2 ???
- SE_Shares = CalculateSharesToTrade(Pivot2_LowRev, FirstStop - Pivot2_LowRev);
- order_Entry("SHORT", RT, SE_Shares, Pivot2_LowRev, "SE Pivot2 Rev", Pivot2_order_type) ;
- end
- else If (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_LONG_EXIT) then
- order_Exit("LX Pivot2 RevExit", 0, Pivot2_LowRev);
- DrawLine(TL_Pivot2RevStop,TXT_Pivot2RevStop,NumToStr(Pivot2_LowRev,2),Pivot2_LowRev,Pivot1_RevStop_Color,"Pivot2 Stop");
- end;
- end;
- if MarketPosition=-1 then begin
- // 2 different possibilities
- // 1. A new pivot low is formed and break above the right bars
- // 2. a break of the pivot high
- if Pivot2_Low_EntryOK and Pivot2_Low_EntryPr > 0 and (not TradeOnlySameDay or Valid_Pivot2_LowBar > NewDayBarNum) then begin
- if permit_LONG and
- (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) and
- (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) and
- Pivot2_MA1Filt_Long_Entry_Allow
- then
- order_Entry(false, Pivot2_Low_EntryPr, "LONG", RT, Pivot2_Low_EntryPr, "LE Pivot2 eRev", Pivot2_order_type)
- else If (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX Pivot2 Exit3", 0, Pivot2_Low_EntryPr);
- end;
- if Pivot2_HighRev > 0 and close < Pivot2_HighRev then begin
- if permit_LONG and
- (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) and
- (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) and
- Pivot2_MA1Filt_Long_Entry_Allow
- then begin
- FirstStop = CalculateFirstStop("LONG",false, Pivot1_HighRev); //<-------------------------- should there be Pivot2 ???
- LE_Shares = CalculateSharesToTrade(Pivot2_HighRev, Pivot2_HighRev - FirstStop);
- order_Entry("LONG",RT, LE_Shares, Pivot2_HighRev, "LE Pivot2 Rev", Pivot2_order_type);
- end
- else If (Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX Pivot2 RevExit", 0, Pivot2_HighRev);
- DrawLine(TL_Pivot2RevStop,TXT_Pivot2RevStop,NumToStr(Pivot2_HighRev,2),Pivot2_HighRev,Pivot1_RevStop_Color,"Pivot2 Stop");
- end;
- end;
- end
- else
- check_for_exit=true;
- end
- else
- check_for_exit=true;
- If (check_for_exit) then begin
- // break of the last trailing pivot high/low as the exit point
- if MarketPosition=1 and IsBetween(0, Pivot2_LowRev, close) then begin
- If Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_LONG_EXIT then begin
- order_Exit("LX Pivot2 Exit", 0, Pivot2_LowRev);
- DrawLine(TL_Pivot2RevStop,TXT_Pivot2RevStop,NumToStr(Pivot2_LowRev,2),Pivot2_LowRev, Pivot1_RevStop_Color,"Pivot2 Stop");
- end;
- end;
- if MarketPosition=-1 and IsBetween(0, close, Pivot2_HighRev) then begin
- if Pivot2_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit then begin
- order_Exit("SX Pivot2 Exit", 0, Pivot2_HighRev);
- DrawLine(TL_Pivot2RevStop,TXT_Pivot2RevStop,NumToStr(Pivot2_HighRev,2),Pivot2_HighRev,Pivot1_RevStop_Color,"Pivot2 Stop");
- end;
- end;
- end;
- end;
- #endregion
- // ############
- #region Pivot 2 Entries
- // vars:
- // intrabarpersist Pivot2_LE_ThisTick(false),
- // intrabarpersist Pivot2_SE_ThisTick(false),
- // intrabarpersist Pivot2_LE_UsePrevPrice(false),
- // intrabarpersist Pivot2_SE_UsePrevPrice(false),
- // intrabarpersist Pivot2_LE_Price(0),
- // intrabarpersist Pivot2_SE_Price(0);
- // Use previously set intrabar price for limit entry if we had a Pivot2 entry last tick
- if Pivot2_SE_ThisTick then
- Pivot2_SE_UsePrevPrice = true;
- if Pivot2_LE_ThisTick then
- Pivot2_LE_UsePrevPrice = true;
- Pivot2_SE_ThisTick = false;
- Pivot2_LE_ThisTick = false;
- if Pivot2_Entry_____________ONOFF =1 then begin
- if TradeOK_ORB_ed and MarketPosition=0 then begin //and (ORB_Entry_____________ONOFF = 0 or NumTradesToday > 0 or SkipORSetup)
- // if ORB_Entry_____________ONOFF is off then the first trade of the day will be triggered by the first break of the first swing pivot high or low instead.
- if Pivot2_High_EntryOK and Pivot2_High_EntryPr > 0 and
- (Valid_Pivot2_HighBar > NewDayBarNum or not TradeOnlySameDay)
- then
- If (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) and Pivot2_MA1Filt_Short_Entry_Allow then begin
- If permit_SHORT then
- order_Entry(false, Pivot2_High_EntryPr, "SHORT", RT, Pivot2_High_EntryPr, "SE Pivot2", Pivot2_order_type);
- end;
- if Pivot2_Low_EntryOK and Pivot2_Low_EntryPr > 0 and
- (Valid_Pivot2_LowBar > NewDayBarNum or not TradeOnlySameDay)
- then
- If (Pivot2_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) and Pivot2_MA1Filt_Long_Entry_Allow then begin
- If permit_LONG then
- order_Entry(false, Pivot2_Low_EntryPr, "LONG", RT, Pivot2_Low_EntryPr, "LE Pivot2", Pivot2_order_type);
- end;
- end;
- end;
- #endregion
- // ##################################################################################################################
- // ############################################## Pivot3 orders ################################################
- #region Pivot3 Exit / Reversal
- if Pivot3_Entry_____________ONOFF = 1 or Pivot3_Exit______________ONOFF = 1 then begin
- // Check for break of last pivot high
- if high[1] >= Pivot3_HighRev[1] then
- Pivot3_HighBreakBar = Valid_Pivot3_HighBar[1];
- // Check for break of last pivot low
- if low[1] <= Pivot3_LowRev[1] then
- Pivot3_LowBreakBar = Valid_Pivot3_LowBar[1];
- // Break on current bar when long also needs to be a break bar
- if high >= Pivot3_HighRev and MarketPosition=1 then
- Pivot3_HighBreakBar = Valid_Pivot3_HighBar;
- // Break on current bar when short also needs to be a break bar
- if low <= Pivot3_LowRev and MarketPosition=-1 then
- Pivot3_LowBreakBar = Valid_Pivot3_LowBar;
- if Pivot3_TrailingReversal = 1
- and TradeOK_ORB_ed
- then begin
- if MarketPosition=1 and IsBetween(0, Pivot3_LowRev, close) then begin
- if (Pivot3_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) and
- (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_LONG_Exit)
- then
- If permit_SHORT then
- order_Entry(false, Pivot1_LowRev, "SHORT", RT, Pivot3_LowRev, "SE Pivot3 Rev", Pivot3_order_type) //<-------------------------- should there be Pivot3_LowRev ???
- else If (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_LONG_EXIT) then
- order_Exit("LX Pivot3 RevExit", 0, Pivot3_LowRev);
- DrawLine(TL_Pivot3RevStop,TXT_Pivot3RevStop,NumToStr(Pivot3_LowRev,2),Pivot3_LowRev,Pivot3_RevStop_Color,"Pivot3 Stop");
- end;
- if MarketPosition=-1 and IsBetween(0, close, Pivot3_HighRev) then begin
- if (Pivot3_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) and
- (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit)
- then
- If permit_LONG then
- order_Entry(false, Pivot1_HighRev, "LONG", RT, Pivot3_HighRev, "LE Pivot3 Rev", Pivot3_order_type) //<-------------------------- should there be Pivot3_HighRev ??
- else If (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then
- order_Exit("SX Pivot3 RevExit", 0, Pivot3_HighRev);
- DrawLine(TL_Pivot3RevStop,TXT_Pivot3RevStop,NumToStr(Pivot3_HighRev,2),Pivot3_HighRev,Pivot3_RevStop_Color,"Pivot3 Stop");
- end;
- end
- else begin
- // break of the last trailing pivot high/low as the exit point
- if MarketPosition=1 and Pivot3_LowRev > 0 and close > Pivot3_LowRev then
- If (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_LONG_EXIT) then begin
- order_Exit("LX Pivot3 Exit", 0, Pivot3_LowRev);
- DrawLine(TL_Pivot3RevStop,TXT_Pivot3RevStop,NumToStr(Pivot3_LowRev,2),Pivot3_LowRev,Pivot3_RevStop_Color,"Pivot3 Stop");
- end;
- if MarketPosition=-1 and Pivot3_HighRev > 0 and close < Pivot3_HighRev then
- If (Pivot3_Exit_main_filters_ONOFF=0 or filters_ok_SHORT_Exit) then begin
- order_Exit("SX Pivot3 Exit", 0, Pivot3_HighRev);
- DrawLine(TL_Pivot3RevStop,TXT_Pivot3RevStop,NumToStr(Pivot3_HighRev,2),Pivot3_HighRev,Pivot3_RevStop_Color,"Pivot3 Stop");
- end;
- end;
- end;
- #endregion
- // ##########
- #region Pivot3 Entries
- // vars:
- // intrabarpersist LEPivot3Entry_Active(false),
- // intrabarpersist SEPivot3Entry_Active(false);
- if Pivot3_Entry_____________ONOFF = 1 then begin // and (ORB_Entry_____________ONOFF = 0 or NumTradesToday > 0 or SkipORSetup)}
- if TradeOK_ORB_ed then begin
- // Check for break of last pivot high
- if high[1] >= Pivot3_HighRev[1] then
- Pivot3_HighBreakBar = Valid_Pivot3_HighBar[1];
- // Check for break of last pivot low
- if low[1] <= Pivot3_LowRev[1] then
- Pivot3_LowBreakBar = Valid_Pivot3_LowBar[1];
- // Break on current bar also triggers a break bar, provided we don't already have a pivot entry active
- if LEPivot3Entry_Active = false and high >= Pivot3_HighRev then
- Pivot3_HighBreakBar = Valid_Pivot3_HighBar;
- if SEPivot3Entry_Active = false and low <= Pivot3_LowRev then
- Pivot3_LowBreakBar = Valid_Pivot3_LowBar;
- // if ORB_Entry_____________ONOFF is off then the first trade of the day will be triggered by the first break of the first swing pivot high or low instead.
- LEPivot3Entry_Active = false;
- SEPivot3Entry_Active = false;
- if MarketPosition=0 then begin
- // When we first send the entry price must be above the pivot
- // However once entry is activated the order should stay open
- if
- Pivot3_LowRev > 0 and
- (close > Pivot3_LowRev or SEPivot3Entry_Active) and
- Pivot3_LowBreakBar < Valid_Pivot3_LowBar and
- (Not TradeOnlySameDay or
- (
- ( Pivot3_Complete_Reset_new_day=0 ) or
- ( Pivot3_Complete_Reset_new_day=1 and Valid_Pivot3_LowBar > NewDayBarNum ) or
- ( Pivot3_Complete_Reset_new_day=2 and Valid_Pivot3_LowBar > NewDayBarNum and Pivot3_LowBreakBar > NewDayBarNum )
- )
- )
- then begin
- If (Pivot3_Entry_main_filters_ONOFF=0 or filters_ok_SHORT_Entry) then begin
- If permit_SHORT then begin
- //FirstStop = Pivot1_LowRev * (1 + FirstProtectiveStopPctDistance * 0.01);
- SEPivot3Entry_Active = order_Entry(false, Pivot3_LowRev, "SHORT", RT, Pivot3_LowRev, "SE Pivot3", Pivot3_order_type);
- end;
- end;
- end;
- // When we first send the entry price must be below the pivot
- // However once entry is activated the order should stay open
- if
- Pivot3_HighRev > 0 and
- (close < Pivot3_HighRev or LEPivot3Entry_Active) and
- Pivot3_HighBreakBar < Valid_Pivot3_HighBar and
- (Not TradeOnlySameDay or
- (
- ( Pivot3_Complete_Reset_new_day=0 ) or
- ( Pivot3_Complete_Reset_new_day=1 and Valid_Pivot3_HighBar > NewDayBarNum ) or
- ( Pivot3_Complete_Reset_new_day=2 and Valid_Pivot3_HighBar > NewDayBarNum and Pivot3_HighBreakBar > NewDayBarNum )
- )
- )
- then
- If (Pivot3_Entry_main_filters_ONOFF=0 or filters_ok_LONG_Entry) then begin
- If (permit_LONG) then
- LEPivot3Entry_Active= order_Entry(false, Pivot3_HighRev, "LONG", RT, Pivot3_HighRev, "LE Pivot3", Pivot3_order_type);
- end;
- end;
- end;
- end;
- #endregion
- // #####################################################################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement