NexusFi: Find Your Edge


Home Menu

 





Looking for help with contrarian use of a pivot breakout


Discussion in EasyLanguage Programming

Updated
    1. trending_up 759 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 1 attachments




 
Search this Thread

Looking for help with contrarian use of a pivot breakout

  #1 (permalink)
xxjoocexx
Akron, Oh
 
Posts: 8 since Oct 2021
Thanks Given: 3
Thanks Received: 5

Hey all. I'm looking for some help with a switch or maybe a series of switches when using a pivot. I want to test a theory that a breakout/breakdown of a pivot high/low has a tendency to retrace momentarily. Here's a summary and example of what I'm trying to do:

Find a pivot high, record that value, look for a break and close above that value and go short. I have this working, but my problem is only doing it once. See image below, pivot at 4094.75 and horizontal line extended across for ease of reference.



Here's the code I used to do this:
 
Code
//triggers
Value1 = Pivot(high, 50, strength, strength, 1, 1, oPivotPrice, oPivotBar);
Value2 = oPivotPrice;	
BreakAbove= close > value2;

//check if preceding candle is a break above
If Breakabove[1] Then
	Begin
		FirstBreak = False;
	End
	Else 
		Begin
			FirstBreak = true;
		End;


//If Time > StartTime and Time < EODTime Then
//begin;
	If BreakAbove and FirstBreak Then
		Begin
			Sellshort ( "PIVRETS") next bar at Open;
			Print ( "date", Date, "time", time, "Short taken");
			BreakBody = Close-open; //getting the candle's body point value for exits
		End;
//End;
This stopped repeated occurrences except when the bars dip back below the recorded pivot high and break above again as in the picture (albeit slightly in this example). I'm drawing a blank on a way to turn off the setup after just one close above. Needs to reset when a new pivot is discovered. Any ideas?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
abev
seattle washington
 
Posts: 75 since Feb 2019
Thanks Given: 11
Thanks Received: 29

I think I get what you want. You are attempting to stop the entries after the first entry. I'd code an input for how many entries were allowed in a day and a counter so that only x entries may take place in a day. But that's me. I'd like to see what happens when I allow x entries and what I might learn from them. I see that both entries were green so .... why not allow multiple entries?

But... if you just want to stop multiple entries, I suspect you will need to zero or null the controlling variable after each bar has been evaluated -- looks to me like that variable is Value2. I've not tried/tested your code so take my suggestion with a grain (or more) of salt.

Reply With Quote




Last Updated on February 19, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts