HELP WITH ERROR 4107

Post Reply
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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 ? :?:
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

I have applied fxdaytrader's modification to the latest update of BASA, plus I have applied NormalizePrice to take profit and stop loss.
You do not have the required permissions to view the files attached to this post.
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

bob shelley v1o pending buystop sellstop orders

Post by fxdaytrader »

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
You do not have the required permissions to view the files attached to this post.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: bob shelley v1o pending buystop sellstop orders

Post by fx800 »

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
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

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-)
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

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)
You do not have the required permissions to view the files attached to this post.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

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.
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: HELP WITH ERROR 4107

Post by fx800 »

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.
Last edited by Anonymous on Mon Aug 19, 2013 10:14 am, edited 4 times in total.
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: HELP WITH ERROR 4107

Post by fxdaytrader »

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-)
Post Reply

Return to “Coders Hangout”