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

HELP WITH ERROR 4107
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=2914
Page 6 of 18
Author:  fx800 [ Sat Aug 17, 2013 11:06 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:An good idea could be the following for debugging:
Insert something like Print("price: "+price+" take: "+take+" stop: "+stop+" expiry: "+TimeToStr(expiry)); just before the SendSingleTrade-call.

We'll see next week. I am just an amateur-coder, so I may need longer to solve some problems (or to find my mistakes :mrgreen: ), ... ;)
I have added the debugging line as follows

Code: Select all

   if (SendTrade)
   {
      if (!SendAlertNotTrade) 
      { 
      
         int expiry=0;
         
         Print("price: "+price+" take: "+take+" stop: "+stop+" expiry: "+TimeToStr(expiry)); 
         
         result = SendSingleTrade(Symbol(), type, TradeComment, SendLots, price, stop, take);
         if (result) 
         {
            if (EmailTradeNotification) SendMail("Trade sent ", Symbol() + stype + "trade at " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES));
            if (AlertPush) AlertNow(WindowExpertName() + " " + Symbol() + " " + stype + " " + DoubleToStr(price, Digits) );
            OrderSelect(TicketNo, SELECT_BY_TICKET, MODE_TRADES);
            CheckTpSlAreCorrect(type);
         }//if (result)          
      }//if (!SendAlertNotTrade)  
I wonder is this correct ? :?:
Author:  fx800 [ Sat Aug 17, 2013 6:52 pm ]
Post subject:  Re: HELP WITH ERROR 4107

I have applied fxdaytrader's modification to the latest update of BASA, plus I have applied NormalizePrice to take profit and stop loss.
Author:  fxdaytrader [ Sun Aug 18, 2013 1:14 pm ]
Post subject:  bob shelley v1o pending buystop sellstop orders

attached my version (based upon Bob Shelley version 1o), set UsePendingOrders=true to use pendings, false to use marketorders.
Search for my name fxdaytrader in the sourcecode to find my changes/mods.

I hope there will take place some trade-entries tomorrow to spot bloops or see everything works finde 8-) :P
Bob and Shelley Again.v1o.PendingOrders.fxdaytrader.mq4
Author:  fx800 [ Sun Aug 18, 2013 3:47 pm ]
Post subject:  Re: bob shelley v1o pending buystop sellstop orders

fxdaytrader wrote:attached my version (based upon Bob Shelley version 1o), set UsePendingOrders=true to use pendings, false to use marketorders.
Search for my name fxdaytrader in the sourcecode to find my changes/mods.

I hope there will take place some trade-entries tomorrow to spot bloops or see everything works finde 8-) :P
Bob and Shelley Again.v1o.PendingOrders.fxdaytrader.mq4
Thank you very much, fxdaytrader. I sincerely hope your efforts will pay dividends and many other forum members will benefit as well.

I understand many re-entry trades from the original ea suffer from false entries, and the pending order is the solution for the problem. If a move lack momentum and fails to break the previous bar high/low, then the trade will not be triggered. This is certainly my experience when trading the strategy manually.

Will put it on demo for the start of trading tonight.

:D :D :D
Author:  fxdaytrader [ Mon Aug 19, 2013 3:19 am ]
Post subject:  Re: HELP WITH ERROR 4107

still waiting for new entries.

If everything works as desired I will upoload the version with the option to set TP (takeprofit) to weekly R1/R2 pivots (see also the posting in the thread 10.x trading like a boss):
Aim for TP of WR1 OR close any trade early if the H1 CSS colour changes back to red (or grey if extra cautious).
-> even if i enter at MS2 i aim for WR1? or do you go level by level?

Yes TP always WR1 or WS1
I think this is an good idea - Although we use jumping stops and/or fix tp-pips it could make sense to set the tp to this levels (or some pips above/below). But, we have got time, Rome was not build in one day also :mrgreen:

But I am not sure yet how to handle the different trades - I think the user should be able to choose whether all the trades are set TP=weeklyr1/r2 or only maintrades, or re-entry or stacktrades. So I think I will not modify the calculatetakeprofit-function, but will add one new and call it right before the ordersend-command. We will see ...

edit: changes done. Still waiting for signals to see if everything is ok ... 8-)
Author:  fxdaytrader [ Mon Aug 19, 2013 8:12 am ]
Post subject:  Re: HELP WITH ERROR 4107

See new version attached (+ pivot stuff, but not yet tested), some minutes ago one buystoporder for gbpusd (different ma-settings) was sent and there was no error.

If you do not like the debug-messages, set UseDebug=false ...

edit: I forgot to add a new swap-filter, pls. download again.
Some brokers never offer positive swap - so if you choose positiveswap only, there would be no trading.
So I added the filter OnlyTradeSwapHigherThanAmount.
If true, it will be checked if swap > SwapMustBeHigherThan (set it e.g. to -3.50 as default) and if so, trading is enabled ...

that is what I have added at the end of Steves TradeDirectionBySwap function :

Code: Select all

   //OnlyTradeSwapUntilMaxAmount filter, added by fxdaytrader
   if (OnlyTradeSwapHigherThanAmount)
   {
      if (LongSwap > SwapMustBeHigherThan) TradeLong = true;
       else TradeLong = false;
      if (ShortSwap > SwapMustBeHigherThan) TradeShort = true;
       else TradeShort = false;
   }//if (OnlyTradeSwapHigherThanAmount)
Author:  fx800 [ Mon Aug 19, 2013 8:38 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:See new version attached (+ pivot stuff, but not yet tested), some minutes ago one buystoporder for gbpusd (different ma-settings) was sent and there was no error.

If you do not like the debug-messages, set UseDebug=false ...

edit: I forgot to add a new swap-filter, pls. download again.
Some brokers never offer positive swap - so if you choose positiveswap only, there would be no trading.
So I added the filter OnlyTradeSwapHigherThanAmount.
If true, it will be checked if swap > SwapMustBeHigherThan (set it e.g. to -3.50 as default) and if so, trading is enabled ...

that is what I have added at the end of Steves TradeDirectionBySwap function :

Code: Select all

   //OnlyTradeSwapUntilMaxAmount filter, added by fxdaytrader
   if (OnlyTradeSwapHigherThanAmount)
   {
      if (LongSwap > SwapMustBeHigherThan) TradeLong = true;
       else TradeLong = false;
      if (ShortSwap > SwapMustBeHigherThan) TradeShort = true;
       else TradeShort = false;
   }//if (OnlyTradeSwapHigherThanAmount)
No trades yet with the previous version.
Author:  fxdaytrader [ Mon Aug 19, 2013 8:49 am ]
Post subject:  Re: HELP WITH ERROR 4107

yes. I use other settings ...

I forgot to implement one filter, because PendingOrderHighLowTF should not be 0 (because PendingOrderHighLowTF will be multiplikated with 60 and barstokeeppendings) ...

the filter is:

Code: Select all

if (PendingOrderHighLowTF==0) PendingOrderHighLowTF=Period();
you can put this in the init()-section.
Author:  fx800 [ Mon Aug 19, 2013 9:04 am ]
Post subject:  Re: HELP WITH ERROR 4107

fxdaytrader wrote:See new version attached (+ pivot stuff, but not yet tested), some minutes ago one buystoporder for gbpusd (different ma-settings) was sent and there was no error.

If you do not like the debug-messages, set UseDebug=false ...

edit: I forgot to add a new swap-filter, pls. download again.
Some brokers never offer positive swap - so if you choose positiveswap only, there would be no trading.
So I added the filter OnlyTradeSwapHigherThanAmount.
If true, it will be checked if swap > SwapMustBeHigherThan (set it e.g. to -3.50 as default) and if so, trading is enabled ...

that is what I have added at the end of Steves TradeDirectionBySwap function :

Code: Select all

   //OnlyTradeSwapUntilMaxAmount filter, added by fxdaytrader
   if (OnlyTradeSwapHigherThanAmount)
   {
      if (LongSwap > SwapMustBeHigherThan) TradeLong = true;
       else TradeLong = false;
      if (ShortSwap > SwapMustBeHigherThan) TradeShort = true;
       else TradeShort = false;
   }//if (OnlyTradeSwapHigherThanAmount)
Why are we having so much trouble with pending stop orders.

There appears to be no such problems with the Multi 10.4 trader. I checked the 10.4 trader code and do not see any need to Normalize take profit or stoploss.

I tried implementing the BASA basic entry rules on the Multi 10.4 template, but it is not taking any trades. i.e. buy when RSI < 10, 60LWMA > 240LWMA, CLOSE[1] > 60LWMA, PENDING ORDER HIGH[1] + BUFFER.
Author:  fxdaytrader [ Mon Aug 19, 2013 9:08 am ]
Post subject:  Re: HELP WITH ERROR 4107

Hm, as I mentioned before, it seems that on my Empty4 everything works as desired.
The trade some hours ago was placed, with the minimum expiration time (11 minutes), because the other calculation went wrong because of the timeframe=0 problem (see my previous post).

But no errors at all. 8-)
All times are UTC Page 6 of 18