stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Scalping New York
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=6189
Page 6 of 31
Author:  sangratan [ Fri May 20, 2022 7:47 pm ]
Post subject:  Scalping New York

only really ridiculous DD....
Author:  SteveHopwood [ Fri May 20, 2022 7:56 pm ]
Post subject:  Scalping New York

sangratan » Fri May 20, 2022 7:44 pm wrote:Hi,
I really like the pairing "Scalpy-CSS"
this happened following simply the strongest currencies for today......
I tryed to go for H4 tf but Scalpy didn't started,I think that for bigger tf it's better....
so I did all trades on H1.....
may be you must calibrate TP relative to how many cross pairs Scalpy matches ,
if i choice two or three currencies the relative cross are about 9-10
and Scalpy matches about three or four trades,so I reduce TP from 100 to 36-60.....
today were 6 sessions......not bad only for looking every hour trend
cheers
Highly impressive results. :clap: :clap: :clap: :clap: :clap: :clap: :party: :party: :party: :party:

I started the multiple trading during the day version today - Multiple Scalpy. I should have a bug-testing version in place for the markets opening after the weekend.

As we progress, I am open to adding the incredible tools such as CSS, SuperSlope and HGI as options when traders are finding them helpful. Let us see how we go.

:xm: :rocket:
Author:  sangratan [ Fri May 20, 2022 8:33 pm ]
Post subject:  Scalping New York

really amazing Steve.....
I think that the Css has a really impressive potential based on real and concrete data....
I don't remember wher but in some place of the forum I have read that
Css is the only known Indicator that permit to watch the live market ....as it unfolds
Author:  SteveHopwood [ Sat May 21, 2022 2:00 pm ]
Post subject:  Scalping New York

I have written Multiple Scalpy. We need to ensure that we do not send another batch of trades when the orders sent at the open of the hour close within minutes.

I immediately ran into the snag of the difference between broker and local time and the fact that order open and close times are shown in broker time. I have coded a function to calculate the difference between these ie an 'offset'.

Would the coders here please run your eyes over the function and see if you can spot anything wrong? Even better, if you already have a working function that you know does this then please post it.

Code: Select all

bool testForAlreadyTradedThisHour()
{

   //The function returns 'true' if it finds an order that opened
   //or closed during the hour, else returns 'false'

   if (OrdersHistoryTotal() == 0)
      return(false);
      

      //Order times are broker time, so we need the offset between
      //that and local time
      int hourLocal = TimeHour(TimeLocal() );   
      
      int hourBroker = TimeHour(TimeCurrent() );
      
      //Calculate the offset between broker and local time
      int hourOffset = hourBroker - hourLocal;

      
   for (int cc = OrdersHistoryTotal() - 1; cc >= 0; cc--)
   {
      if (!betterOrderSelect(SELECT_BY_POS, MODE_TRADES, MODE_HISTORY) )
         continue;
         
         
      //Did the order open during the hour?
      //If hourOffset is negative, this will cause openTime to be 
      //incremented as subtracting a negative from a negative
      //results in a positive.
      int openHour = TimeHour(OrderOpenTime() ) - hourOffset;   
      
      //Is the order offset opening hour the same as local hour?
      if (openHour == hourLocal)
         return(true);//Yes, so already traded this hour
         
         
      //Is the order offset closing hour the same as local hour?
      int closeHour = TimeHour(OrderCloseTime() ) - hourOffset;
      if (closeHour == hourLocal)
         return(true);//Yes, so no more trading until a new H1 candle forms. 
         
         
      
   }//for (int cc = OrdersHistoryTotal() - 1; cc >= 0; cc--)
   

   //Reached here, so no trades this hour
      return(false);

}//End bool testForAlreadyTradedThisHour()
:xm: :rocket:
Author:  szfxtrader [ Sat May 21, 2022 7:45 pm ]
Post subject:  Scalping New York

Why don't you just compare the broker time?
My reply (Steve)
Because Scalpy's time inputs are in local time, not broker time. Trust me, you don't want to get into working out when London and New York are opening at GMT +x in your world, then converting that when broker time is GMT+x or GMT-x.

You would go insane.

:xm: :rocket:
Author:  szfxtrader [ Sat May 21, 2022 9:25 pm ]
Post subject:  Scalping New York

szfxtrader » Sat May 21, 2022 7:45 pm wrote:
Why don't you just compare the broker time?
My reply (Steve)
Because Scalpy's time inputs are in local time, not broker time. Trust me, you don't want to get into working out when London and New York are opening at GMT +x in your world, then converting that when broker time is GMT+x or GMT-x.

You would go insane.

:xm: :rocket:
I understand that, but the Empty4 order history uses broker time, so if the order is open at 16h broker time and the local time is 10h for example, after x minutes when the order be closed, the closing order time(hour) can be the same or not of the order opening time(hour), so in the end at last for me you don't need to compare it with the local time because your opening/closing time will be from the Empty4 order history, and the function will not allow a new trade if the opening/closing time is equal current broker time(hour), that's what I a mean, all the best.
Author:  SteveHopwood [ Sun May 22, 2022 7:26 pm ]
Post subject:  Scalping New York

szfxtrader » Sat May 21, 2022 9:25 pm wrote:
I understand that, but the Empty4 order history uses broker time, so if the order is open at 16h broker time and the local time is 10h for example, after x minutes when the order be closed, the closing order time(hour) can be the same or not of the order opening time(hour), so in the end at last for me you don't need to compare it with the local time because your opening/closing time will be from the Empty4 order history, and the function will not allow a new trade if the opening/closing time is equal current broker time(hour), that's what I a mean, all the best.
Thanks for that. :clap: :clap: :clap: :clap: :clap: :clap:

I often remark that it is not the code that I find difficult but constructing the algorithm in the first place. I was guilty of complicating something that is really, really simple. :arrrg:

I will let MS run tomorrow to try to iron out the bugs, then let you folks have it tomorrow night.

:xm: :rocket:
Author:  SteveHopwood [ Sun May 22, 2022 7:55 pm ]
Post subject:  Scalping New York

One for the logicians here.

The break even and auto closure hour inputs have morphed into hours-to-wait after the orders have been sent. In the function I have coded, BreakEvenStartWaitingHours is the input for the hours to leave the basket alone before looking to get out at BE - defaulting to 2:

Code: Select all

void lookForBreakevenClosure()
{

   //The basket has not hit TP, so look for opportunities to get out
   //at breakeven+
   
   //countOpenTrades() makes a note of the oldest trade open time and ticket number
   
   //Get the hour the order was sent by selecting the order
   if (!betterOrderSelect(oldestTradeTicketNo, SELECT_BY_TICKET, MODE_TRADES) )
      return;
   
   //Calculate the break even start hour
   int breakEvenStartHour = TimeHour(OrderOpenTime() ) + BreakEvenStartWaitingHours;
   
   //Are we at breakeven hour?
   int t = TimeHour(TimeCurrent() );
   if (t < breakEvenStartHour)
      return;//No

   //Can we get out at breakeven+?
   if (cashUpl >= 0)//Yes
   {
      closeAllTrades(allTrades);
      Alert("Break even position closure at " + TimeToStr(TimeLocal()) ) ;
   }//if (cashUpl >= 0)//Yes
   
      
}//void lookForBreakevenClosure()
The problem is this: imagine the orders are sent at 23.00 broker time. Add BreakEvenStartWaitingHours to this and we get to 25 as the breakEvenStartHour. Broker time can never reach this so the orders can never be closed unless they hit TP.

If we try to solve the problem by subtracting 24 from breakEvenStartHour then MS will close the position the moment it reaches BE, robbing us of the chance to reach TP. The situation is the same in the function that looks for automatic closure.

Any ideas, folks?

:xm: :rocket:
Author:  sangratan [ Sun May 22, 2022 9:33 pm ]
Post subject:  Scalping New York

Hi,
may be I saying the most stupid thing yoy ever heard in your life.....
but i am not a coder and I don't have idea about technician arguments....
Is it crazy put the date value near the hour value
when we set the hour number for trades and BE sending .....
In the example done about ( 23:00 )
is not possible set trades sending at hour 23:00 and date 22/05/2022 and BE time 01:00 and 23/05/2022 ?
if I said a stupid thing forgive me, it is the simplest thing that came to my mind...
sorry for that
Author:  SteveHopwood [ Sun May 22, 2022 9:45 pm ]
Post subject:  Scalping New York

sangratan » Sun May 22, 2022 9:33 pm wrote:Hi,
may be I saying the most stupid thing yoy ever heard in your life.....
but i am not a coder and I don't have idea about technician arguments....
Is it crazy put the date value near the hour value
when we set the hour number for trades and BE sending .....
In the example done about ( 23:00 )
is not possible set trades sending at hour 23:00 and date 22/05/2022 and BE time 01:00 and 23/05/2022 ?
if I said a stupid thing forgive me, it is the simplest thing that came to my mind...
sorry for that
Thank you again for some wonderful help. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

We have a thing here in the UK that we label KISS. This stands for, Keep It simple, Stupid (i.e.Keep It Simple, you idiot and stop over-complicating stuff - like I do :arrrg: ). :lol:

It is late here in the UK so I am not going to code this but I know what to code now. Thanks again.

:xm: :rocket:
All times are UTC Page 6 of 31