something like spread

Questions about MultiCharts and user contributed studies.
RedBerlin
Posts: 81
Joined: 05 Dec 2014

something like spread

Postby RedBerlin » 19 Sep 2020

hi everyone
I need help about an idea of trading system based on these parameters
if at 12 o clock am Apple 'future is negative or just a bit positive not more 0.20% and at same time Amazone future is positive up 0.40% short apple .
that is all.
it is possible caalculate both in % or in points, it is same.
thanks for your help

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 22 Sep 2020

Do you already have a piece of code we can continue the work from? That would make helping easier and quicker for us.

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 22 Sep 2020

JOSH HI
NO i have nothing just this idea.
it is almost impossible to backtesting but I ve wathed the market for years and is a very profittable
strategy with 2 right instruments.
trust of me

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 23 Sep 2020

I don't care about profitable strategies, but I do think this is backtestable (or I must be overlooking something).

If you can make your instructions more explicit, they can probably be turned into code.

As an example, two things that I don't understand from your original post is what the future is (a single stock future?) and how you calculate the percentages.
if at 12 o clock am Apple 'future is negative or just a bit positive not more 0.20% and at same time Amazone future is positive up 0.40% short apple

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 24 Sep 2020

hii Josh tjhanks for your time,
the strategy is very simple maybe too much but never mind.
example :
start at 1400- in preopening to wall street
value of nasdaq and sp500.
if nasdaq 100 futures (at 1430 ) is up 0,40% and sp500 future is about around -0,10 % o less then short 3 contracts of sp500 and set 3 target as you want or 1 target .
but at 1700 close all .
pratically if the target are not reach close all at 1700 .
very simple to explain
I ve wrote sp500 nasdaq but could be other.
the logic is that sp 500 in the first 1.5 hours of open will be less strong of nasdaq , more or less.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 24 Sep 2020

The code below is a start. But I don't know how you calculate the percentages. So I can't complete that piece of the puzzle.

Code: Select all

// Data1: ES, Data2: NQ Input: Start_Time(1430), NQ_Entry_Return(0.40), ES_Entry_Return(-0.10); Variables: returnES(0), returnNQ(0), tradeCondition(false); // Look for trades at the specified start time if time = Start_Time then begin returnES = 0; returnNQ = 0; tradeCondition = returnNQ >= NQ_Entry_Return and returnES >= ES_Entry_Return - 0.1 and returnES <= ES_Entry_Return + 0.10; if tradeCondition then begin SellShort ("ES") 3 contracts next bar at market; end; end;

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 26 Sep 2020

thanks Josh
but if we change percentage in points ?
give up on percentage ,maybe in points is possible?
I mean : if ES LOSE 2 POINTS AND ND GAIN 20 POINTS AT 1430 THEN SHORT 3 CONTRACTS OF ES.
another qestion: in pre build and in forum I have not found
code of trendline ,do you have got?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 28 Sep 2020

but if we change percentage in points ?
give up on percentage ,maybe in points is possible?
I mean : if ES LOSE 2 POINTS AND ND GAIN 20 POINTS AT 1430 THEN SHORT 3 CONTRACTS OF ES.
Sure that is possible. But this has the same problem as the percentages. That is, to code a certain point loss or gain we'll need to know the comparison period.

Are you measuring those point lost/gained relative to yesterday's close? Yesterday at 14:30? Yesterday's start of the Globex session? Or does the 14:30 bar need to have a loss of 2 points ES points?
in pre build and in forum I have not found code of trendline ,do you have got?
I don't understand. There's a wiki page with the trend line keywords, if that helps.

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 30 Sep 2020

HI jOSH
Thanks
yes,at yesterday close

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 01 Oct 2020

Okay, with that information we can update the code a little further:

Code: Select all

// Data1: ES, Data2: NQ Input: Start_Time(1430), Close_Time(1700), ES_Entry_Point_Filter(-2), NQ_Entry_Point_Filter(20), NQ_Entry_Return(0.40), ES_Entry_Return(-0.10); Variables: returnES(0), returnNQ(0), tradeCondition(false), esClose(0), nqClose(0); if time = Close_Time then begin esClose = close data1; nqClose = close data2; end; // Look for trades at the specified start time if time = Start_Time then begin returnES = close data1 - esClose; returnNQ = close data2 - nqClose; tradeCondition = returnES <= ES_Entry_Point_Filter and returnNQ >= NQ_Entry_Point_Filter; if tradeCondition then begin SellShort ("ES") 3 contracts next bar at market; end; end;
Is this still correct based on your idea?

Don't be afraid to jump in with your own code. That's the best way to learn. :)

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 02 Oct 2020

hey Josh really thanks
I think just give a look at strategy it si more or less 90percent my idea.
2 things
when I say start entry at 14.30 it means that it is only chance to entry , I mean
if condition is at 15.00 I dont want entry at market.
maybe will be more efficiency say to strategy : open short if condition is good between time 13.45 to 14.45 , it means , if frame for instance is 5 minutes . when
there is condition between 1345-1445 entry open short. but after 1445 stop e go flat if condition there isnt.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: something like spread

Postby JoshM » 05 Oct 2020

when I say start entry at 14.30 it means that it is only chance to entry , I mean
if condition is at 15.00 I dont want entry at market.
I understood so from the original comments. It's in the code with this if statement:

Code: Select all

if time = Start_Time then begin
Code inside this if statement only executes when the bar's time (with minute precision) is exactly the same as the 'Start_Time' input. So if a bar's time is earlier or later, the code doesn't execute.
open short if condition is good between time 13.45 to 14.45 , it means , if frame for instance is 5 minutes . when
there is condition between 1345-1445 entry open short. but after 1445 stop e go flat if condition there isnt.
I don't think I understand you here. Just a couple sentences ago you said that the strategy should really start at 14:30. But now it doesn't anymore? This is quite confusing! :)

RedBerlin
Posts: 81
Joined: 05 Dec 2014

Re: something like spread

Postby RedBerlin » 06 Oct 2020

JOsh thanks ,without testing it I think the strategy is my idea.
about time: I SAID 1430 because usuallly it happens bettwen 1330 to 1530
but, of course it is not matematic .
i said 1430 just to give an input to you but the time exacly to openshort is not easy to decide,for sure is between 1330 and open ws 1530.
at the end of everything the best thing is to say at the strategy: open short between 1400-to 1530.
if is possible change strategy in this way is the best, otherwise never mind.
I HAVE TO ADD , THAT THIS EVENT HAPPENS NOT OFTEN AND so, is give more chance for an open short.
thanks


Return to “MultiCharts”