Gday: a D1 Stochastic OB/OS trading robot

Locked
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by fxozgirl »

SteveHopwood wrote:
gaheitman wrote:Steve,

I think JumpingStopLoss() still relies on it being at breakeven. The code still expect "sl" to have a valid value and makes sure its above the OrderOpenPrice().

This

Code: Select all

   if (OrderType()==OP_BUY)
   {
      if (sl < OrderOpenPrice() ) return;//Not at breakeven yet
      // Increment sl by sl + JumpingStopPips.
      // This will happen when market price >= (sl + JumpingStopPips)
      //if (Bid>= sl + ((JumpingStopPips*2)*Point) ) 
      if (Bid >= MathMax(sl, OrderOpenPrice() ) + ((JumpingStopPips * 2) * Point) )//George{
      {
         NewStop = NormalizeDouble(sl + (JumpingStopPips * Point), Digits);
         if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
         if (NewStop - OrderStopLoss() >= Point) modify = true;//George again. What a guy
         modify = true;   
      }// if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())      
   }//if (OrderType()==OP_BUY)
   
   if (OrderType()==OP_SELL)
   {
      if (sl > OrderOpenPrice() ) return;//Not at breakeven yet
      // Decrement sl by sl - JumpingStopPips.
      // This will happen when market price <= (sl - JumpingStopPips)
      //if (Bid<= sl - ((JumpingStopPips*2)*Point)) Original code
      if (Bid <= MathMin(sl, OrderOpenPrice() ) - ((JumpingStopPips * 2) * Point) )//George
      {
         NewStop = NormalizeDouble(sl - (JumpingStopPips * Point), Digits);
         if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
         if (OrderStopLoss() - NewStop >= Point || OrderStopLoss() == 0) modify = true;//George again. What a guy   
         modify = true;   
      }// close if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())         
   }//if (OrderType()==OP_SELL)
should be this

Code: Select all

   if (OrderType()==OP_BUY)
   {
      //if (sl < OrderOpenPrice() ) return;//Not at breakeven yet
      // Increment sl by sl + JumpingStopPips.
      // This will happen when market price >= (sl + JumpingStopPips)
      //if (Bid>= sl + ((JumpingStopPips*2)*Point) ) 
      sl = MathMax(sl, OrderOpenPrice());
      if (Bid >=  sl + ((JumpingStopPips * 2) * Point) )//George{
      {
         NewStop = NormalizeDouble(sl + (JumpingStopPips * Point), Digits);
         if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
         if (NewStop - OrderStopLoss() >= Point) modify = true;//George again. What a guy
         modify = true;   
      }// if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())      
   }//if (OrderType()==OP_BUY)
   
   if (OrderType()==OP_SELL)
   {
      //if (sl > OrderOpenPrice() ) return;//Not at breakeven yet
      // Decrement sl by sl - JumpingStopPips.
      // This will happen when market price <= (sl - JumpingStopPips)
      //if (Bid<= sl - ((JumpingStopPips*2)*Point)) Original code
      sl = MathMin(sl, OrderOpenPrice());
      if (sl == 0) sl = OrderOpenPrice();
      if (Bid <= sl - ((JumpingStopPips * 2) * Point) )//George
      {
         NewStop = NormalizeDouble(sl - (JumpingStopPips * Point), Digits);
         if (HiddenPips > 0) ObjectMove(LineName, 0, Time[0], NewStop);
         if (OrderStopLoss() - NewStop >= Point || OrderStopLoss() == 0) modify = true;//George again. What a guy   
         modify = true;   
      }// close if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())         
   }//if (OrderType()==OP_SELL)
I commented out the "if (sl < OrderOpenPrice() ) return;" line and reset "sl" to be the value we want to use later, including a second test for sells to make sure it isn't zero.

George
George, that is brilliant.

Guys, you might want to hang on before downloading the latest update. TIG's solution is better than mine, so I am just going to finish catching up on the posts and then will make the edits to the code.

:D
Thanks George...this ea is certainly the better as a result of your input and experience :)
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by fxozgirl »

SteveHopwood wrote: Here we are in the run up to Christmas when the markets are so difficult that a lot of experienced traders shut down their platforms altogether, and we have a system that is making pips. Remarkable achievement, Shelley.

:D
Steve, thank you so much...seriously I was not expecting anybody to show interest in this system. My trading experience and knowledge is but a 'pip', and yet I have the likes of you, George, Gary and others who have shared their time and knowledge to help me and others to gain an edge in this difficult environment. :oops:

Thanks so much
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by fxozgirl »

ROBST3R wrote:Opened aud/usd manually and first trade was taken by the ea! 50 pips secured!

Free trade now :D
It feels good doesn't it :D
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by fxozgirl »

garyfritz wrote: BTW I'm not sure yet but I'm not certain the 3-lot model is necessary. It seems to work almost as well exiting the full position at a single TP -- at least almost as well as my simplified end-of-bar model. The 3-lot model might work better if you're doing realtime jumping stops &etc.

Gary
This is an area that I think we can look at further...
mind you my main criteria is safety first, which is why I decided to do the 1/2/3 especially as we are trading the dailys where 200-300 pip moves are common place.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by SteveHopwood »

Ok, gals and galesses, latest latest update in post 1.

The JS function will work correctly now that TIG has fixed it.

I am dying to catch George out in a bloop of his own. In a pm, I described how I played competitive chess in my younger days. Within a chess club, there was always that player with whom drawing a practise match would be an immense achievement.

I never happens. I suspect catching George out will never happen. Hey ho.

George, can you do us all another favour, please. This fix needs to go into the shell code as well. Before I post it, can you run your slide rule over the trailing stop feature. All these functions derive from mptm and I coded them as part of my learning-the-language process. I knew nothing of features such as MathMax etc, so if you can tidy up the code, that would be great.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by gaheitman »

SteveHopwood wrote:Ok, gals and galesses, latest latest update in post 1.

The JS function will work correctly now that TIG has fixed it.
Well, I'm certain it will work differently, at least. :D
User avatar
dynel14
Trader
Posts: 37
Joined: Wed Nov 16, 2011 1:38 am
Location: Cologne/Germany

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by dynel14 »

SteveHopwood wrote:Ok, gals and galesses, latest latest update in post 1.

The JS function will work correctly now that TIG has fixed it.

I am dying to catch George out in a bloop of his own. In a pm, I described how I played competitive chess in my younger days. Within a chess club, there was always that player with whom drawing a practise match would be an immense achievement.

I never happens. I suspect catching George out will never happen. Hey ho.

George, can you do us all another favour, please. This fix needs to go into the shell code as well. Before I post it, can you run your slide rule over the trailing stop feature. All these functions derive from mptm and I coded them as part of my learning-the-language process. I knew nothing of features such as MathMax etc, so if you can tidy up the code, that would be great.

:D
Thank you Steve for the update and fxozgirl for the method.
Just to make sure...should we set BE true or false? OOTB is false.

dynel14
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by SteveHopwood »

dynel14 wrote:
SteveHopwood wrote:Ok, gals and galesses, latest latest update in post 1.

The JS function will work correctly now that TIG has fixed it.

I am dying to catch George out in a bloop of his own. In a pm, I described how I played competitive chess in my younger days. Within a chess club, there was always that player with whom drawing a practise match would be an immense achievement.

I never happens. I suspect catching George out will never happen. Hey ho.

George, can you do us all another favour, please. This fix needs to go into the shell code as well. Before I post it, can you run your slide rule over the trailing stop feature. All these functions derive from mptm and I coded them as part of my learning-the-language process. I knew nothing of features such as MathMax etc, so if you can tidy up the code, that would be great.

:D
Thank you Steve for the update and fxozgirl for the method.
Just to make sure...should we set BE true or false? OOTB is false.

dynel14
I need to add the break even profit to JS - I forgot - so turn BE on for now. BE also closes the first third of the trade.

Nearly there.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
garyfritz

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by garyfritz »

fxozgirl wrote:Interesting results Gary...when I was trading manually, the stop loss would vary depending on the pair being traded to take into account the volatility of the pair and the daily range.
Stop losses ranged between 200 pips for less volatile pairs & 300 pips for the more volatile pairs.
Yes, I started with fixed stops because I thought that was the way you trade it. I intend to add some volatility-scaled stops and see how that works.
SteveHopwood wrote:Thanks for doing all this Gary. I have linked this post so that newcomers do not miss it.
Once you get a version working that you're happy with, we should compare backtests and make sure that my results (and thus the recommended pairs) actually match up with what everybody will be using.
User avatar
Alpenkorps
Trader
Posts: 213
Joined: Thu Dec 15, 2011 4:03 am

Re: Gday: a D1 Stochastic OB/OS trading robot

Post by Alpenkorps »

garyfritz wrote: Once you get a version working that you're happy with, we should compare backtests and make sure that my results (and thus the recommended pairs) actually match up with what everybody will be using.
Not all backtest result will match because of the time zone difference of different brokers. But its not gonna be a problem in long run I hope.

I am actually thinking something else. We can try it on different timeframes rather than D1, With BE and fixed TP, SL. Just for fun, we might get some interesting result too.
Take my love, take my land, Take me where I cannot stand
I don't care, I'm still free, You can't take the sky from me
Locked

Return to “Automated trading systems”