Hello,
Could anyone help me please?
I have the simple code swing reversals:
[IntrabarOrderGeneration=false]
variables:
support(0),
resistance(0);
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 then begin
if Time>=2300 then buytocover next bar at market;
if Time>=2300 then sell next bar at market;
end;
How to create support and resistance using only the first swinghigh of session
and the first swinglow of session
First SwingHigh and first SwingLow in intraday chart
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
You will need to give more detail on your idea... on the surface, it can be interpreted as something simple, or something complicated.Hello,
Could anyone help me please?
I have the simple code swing reversals:
[IntrabarOrderGeneration=false]
variables:
support(0),
resistance(0);
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 then begin
if Time>=2300 then buytocover next bar at market;
if Time>=2300 then sell next bar at market;
end;
How to create support and resistance using only the first swinghigh of session
and the first swinglow of session
Can you draw a chart to illustrate what you want to do?
it could be as simple as adding a counter...
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
You will need to give more detail on your idea... on the surface, it can be interpreted as something simple, or something complicated.Hello,
Could anyone help me please?
I have the simple code swing reversals:
[IntrabarOrderGeneration=false]
variables:
support(0),
resistance(0);
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 then begin
if Time>=2300 then buytocover next bar at market;
if Time>=2300 then sell next bar at market;
end;
How to create support and resistance using only the first swinghigh of session
and the first swinglow of session
Can you draw a chart to illustrate what you want to do?
it could be as simple as adding a counter...
Hello,
explanation thoughts:
After the open session is created first swinghigh=resistance and first swinglow=support.
This resistance and support will remain stored until the end of the session.
If the high of a bar is under resistance then buy next bar at resistance stop.
If the low of a bar is over support then sellshort next bar at support stop.
At the end of session will support and resistance canceled.
After open a new session is created new first swinghigh=resistance and new first swinglow=support
...and so on...
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
What you need is to "freeze" the value of the first resistance and support.Hello,
explanation thoughts:
After the open session is created first swinghigh=resistance and first swinglow=support.
This resistance and support will remain stored until the end of the session.
If the high of a bar is under resistance then buy next bar at resistance stop.
If the low of a bar is over support then sellshort next bar at support stop.
At the end of session will support and resistance canceled.
After open a new session is created new first swinghigh=resistance and new first swinglow=support
...and so on...
eg.
Code: Select all
var:
First.SwingHigh(false),
First.SwingLow(false);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;
// do the same for SwingLow
Re: First SwingHigh and first SwingLow in intraday chart
What you need is to "freeze" the value of the first resistance and support.Hello,
explanation thoughts:
After the open session is created first swinghigh=resistance and first swinglow=support.
This resistance and support will remain stored until the end of the session.
If the high of a bar is under resistance then buy next bar at resistance stop.
If the low of a bar is over support then sellshort next bar at support stop.
At the end of session will support and resistance canceled.
After open a new session is created new first swinghigh=resistance and new first swinglow=support
...and so on...
eg.Code: Select all
var:
First.SwingHigh(false),
First.SwingLow(false);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;
// do the same for SwingLow
Thank you very much for your help.
I added the code but does not yet work as expected logic.
I do not know where I made a mistake.
Try it on euro fx 1 hourly chart.
Code: Select all
[IntrabarOrderGeneration=false]
var:
First.SwingHigh(false),
First.SwingLow(false),
resistance(0),
support(0);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;
If First.SwingLow = false then
begin
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
First.SwingLow = True;
end;
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 and Time >= 2300 then begin
buytocover next bar at market;
sell next bar at market;
end;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
Hahah...Thank you very much for your help.
I added the code but does not yet work as expected logic.
I do not know where I made a mistake.
Try it on euro fx 1 hourly chart.
Code: Select all
[IntrabarOrderGeneration=false]
var:
First.SwingHigh(false),
First.SwingLow(false),
resistance(0),
support(0);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;
If First.SwingLow = false then
begin
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
First.SwingLow = True;
end;
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 and Time >= 2300 then begin
buytocover next bar at market;
sell next bar at market;
end;
Hint:
you can only trade **IF** and only if a swing high/low has occurred.
Tips:
Instead of jumping into a strategy, you can start with an indicator... plot a dot at where you want to BUY or SELL... and see how things pan out.
Re: First SwingHigh and first SwingLow in intraday chart
Hahah...Thank you very much for your help.
I added the code but does not yet work as expected logic.
I do not know where I made a mistake.
Try it on euro fx 1 hourly chart.
Code: Select all
[IntrabarOrderGeneration=false]
var:
First.SwingHigh(false),
First.SwingLow(false),
resistance(0),
support(0);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;
If First.SwingLow = false then
begin
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
First.SwingLow = True;
end;
if high < resistance then buy next bar at resistance stop;
if low > support then sellshort next bar at support stop;
if marketposition<>0 and Time >= 2300 then begin
buytocover next bar at market;
sell next bar at market;
end;
Hint:
you can only trade **IF** and only if a swing high/low has occurred.
Tips:
Instead of jumping into a strategy, you can start with an indicator... plot a dot at where you want to BUY or SELL... and see how things pan out.
I think now it is working properly.
According to you is the correct logic or I forgot something?
Code: Select all
[IntrabarOrderGeneration=false]
var:
resistance(-1),
support(-1);
If Date <> Date[1] then
begin
resistance=-1;
support=-1;
end;
If resistance=-1 then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
end;
If support=-1 then
begin
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
end;
if high<resistance then buy next bar at resistance stop;
if low>support then sellshort next bar at support stop;
if marketposition<>0 and Time>=2300 then begin
buytocover next bar at market;
sell next bar at market;
end;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
Note: Low is always larger than -1.::
I think now it is working properly.
According to you is the correct logic or I forgot something?
::Code: Select all
::
if low>support then sellshort next bar at support stop;
::
Take another read of my tips above.
Re: First SwingHigh and first SwingLow in intraday chart
Is it right now?Note: Low is always larger than -1.::
I think now it is working properly.
According to you is the correct logic or I forgot something?
::Code: Select all
::
if low>support then sellshort next bar at support stop;
::
Take another read of my tips above.
Code: Select all
[IntrabarOrderGeneration=false]
var:
First.SwingHigh(false),
First.SwingLow(false),
resistance(0),
support(0);
If Date <> Date[1] then
begin
First.SwingHigh = false;
First.SwingLow = false;
end;
If First.SwingHigh = false then
begin
if SwingHigh(1,high,1,2)<>-1 then resistance=SwingHigh(1,high,1,2);
if SwingHigh(1,high,1,2)=resistance then First.SwingHigh = True;
end;
If First.SwingLow = false then
begin
if SwingLow(1,low,1,2)<>-1 then support=SwingLow(1,low,1,2);
if SwingLow(1,low,1,2)=support then First.SwingLow = True;
end;
if First.SwingHigh=true and high<resistance then buy next bar at resistance stop;
if First.SwingLow=true and low>support then sellshort next bar at support stop;
if marketposition<>0 and Time >= 2300 then begin
buytocover next bar at market;
sell next bar at market;
end;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
Congratulations... You've got it.Is it right now?
::
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: First SwingHigh and first SwingLow in intraday chart
Alternative coding:
Code: Select all
If First.SwingHigh = false
AND SwingHigh(1,high,1,2)<>-1
then begin
resistance=SwingHigh(1,high,1,2);
First.SwingHigh = True;
end;