The last fix for WeeklyDirection worked - thanks.
Nanningbob 10.2 auto-trading EA
-
spotdespot
- Trader
- Posts: 768
- Joined: Sun Jan 22, 2012 11:38 pm
Re: 10.2; the auto-trading EA is born.
Thanks for your help with this Philippe. I am still getting the partial close issue - the same as highlighted above. I tried restoring the 2 lines you mentioned (each in 2 places?) but that didn't seem to do the trick. I have tried looking through the code but I am going round in circles....
The last fix for WeeklyDirection worked - thanks.
The last fix for WeeklyDirection worked - thanks.
-
phil_trade
Re: 10.2; the auto-trading EA is born.
Below my JumpingStopLoss routinespotdespot wrote:Thanks for your help with this Philippe. I am still getting the partial close issue - the same as highlighted above. I tried restoring the 2 lines you mentioned (each in 2 places?) but that didn't seem to do the trick. I have tried looking through the code but I am going round in circles....![]()
The last fix for WeeklyDirection worked - thanks.
Code: Select all
void JumpingStopLoss()
{
// Jump sl by pips and at intervals chosen by user .
//if (OrderProfit() < 0) return;//Nothing to do.
//Use the sl line if this is drawn on the chart.
string LineName = SlPrefix + DoubleToStr(OrderTicket(), 0);
double sl = OrderStopLoss();
if (ObjectFind(LineName) > -1)
{
sl = ObjectGet(LineName, OBJPROP_PRICE1);
}//if (ObjectFind(LineName) > -1)
//if (sl == 0) return;//No line, so nothing to do
double NewStop;
bool modify=false;
bool result;
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 (sl == 0) sl = MathMax(sl, OrderOpenPrice());//No hidden stop loss line
if (Bid >= sl + ((JumpingStopPips * 2) * Point) )//George{
{
NewStop = NormalizeDouble(sl + (JumpingStopPips * Point), Digits);
if (AddBEP) NewStop = NormalizeDouble(NewStop + (BreakEvenProfit*Point), Digits);
ObjectMove(LineName, 0, Time[0], NewStop);
if (NewStop - OrderStopLoss() >= Point) modify = true;//George again. What a guy
}// 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 (sl == 0) sl = MathMax(sl, OrderOpenPrice());//No hidden stop loss line
if (Bid <= sl - ((JumpingStopPips * 2) * Point) )//George
{
NewStop = NormalizeDouble(sl - (JumpingStopPips * Point), Digits);
if (AddBEP) NewStop = NormalizeDouble(NewStop - (BreakEvenProfit*Point), Digits);
ObjectMove(LineName, 0, Time[0], NewStop);
if (OrderStopLoss() - NewStop >= Point || OrderStopLoss() == 0) modify = true;//George again. What a guy
}// close if (Bid>= sl + (JumpingStopPips*Point) && sl>= OrderOpenPrice())
}//if (OrderType()==OP_SELL)
//Move 'hard' stop loss whether hidden or not. Don't want to risk losing a breakeven through disconnect.
if (modify)
{
while (IsTradeContextBusy() ) Sleep(100);
result = OrderModify(OrderTicket(), OrderOpenPrice(), NewStop, OrderTakeProfit(), OrderExpiration(), CLR_NONE);
if (!result) ReportError();
Print(Symbol()+" Jumping SL");
if (PartCloseEnabled && OrderLots() > Preserve_Lots)// Only try to do this if the jump stop worked
{
bool PartCloseSuccess = PartCloseTradeFunction();
//if (!PartCloseSuccess) SetAGlobalTicketVariable();
}//if (PartCloseEnabled && OrderLots() > Preserve_Lots)
}//if (modify)
} //End of JumpingStopLoss sub
-
mackaozy
- Trader
- Posts: 190
- Joined: Sat Mar 17, 2012 1:22 pm
Re: 10.2; the auto-trading EA is born.
[/quote]
Hmmm...It's up to steve to do that ! It's his home here
but you can Cut and paste the code and compile it ![/quote]
Yep I guess so
Whereabouts does the code need to be pasted? Sorry I am dumb lol 
Hmmm...It's up to steve to do that ! It's his home here
but you can Cut and paste the code and compile it ![/quote]
Yep I guess so
-
phil_trade
Re: 10.2; the auto-trading EA is born.
Hmmm...It's up to steve to do that ! It's his home heremackaozy wrote:
but you can Cut and paste the code and compile it ![/quote]
Yep I guess so
just replace the JumpingStopLoss() routine
-
mackaozy
- Trader
- Posts: 190
- Joined: Sat Mar 17, 2012 1:22 pm
Re: 10.2; the auto-trading EA is born.
Yep I guess sophil_trade wrote:Hmmm...It's up to steve to do that ! It's his home heremackaozy wrote:![]()
but you can Cut and paste the code and compile it !
just replace the JumpingStopLoss() routine[/quote]
Cheers
-
spotdespot
- Trader
- Posts: 768
- Joined: Sun Jan 22, 2012 11:38 pm
Re: 10.2; the auto-trading EA is born.
Thanks again Philippe - all looking good now.phil_trade wrote:
Below my JumpingStopLoss routine
-
jjasper7
- Trader
- Posts: 87
- Joined: Mon Mar 19, 2012 11:44 pm
- Location: Mesa,AZ (near Phoenix)
Re: 10.2; the auto-trading EA is born.
thank you, phil
re:trend trades ....
changing to ...Direction != up) return(false);
instead of
WeeklyDirection <= up)
is subtle - i do not see the difference! is '<=' not valid in Empty4 or something?
re:trend trades ....
changing to ...Direction != up) return(false);
instead of
WeeklyDirection <= up)
is subtle - i do not see the difference! is '<=' not valid in Empty4 or something?
-
phil_trade
Re: 10.2; the auto-trading EA is born.
for sure <= is valid in Empty4 but we are in routine "LookForLongTrend(int tf)" to see if Trend is Long sojjasper7 wrote:thank you, phil
re:trend trades ....
changing to ...Direction != up) return(false);
instead of
WeeklyDirection <= up)
is subtle - i do not see the difference! is '<=' not valid in Empty4 or something?
if you test "if (WeeklyDirection <= up) return(false);"
then when WeeklyDirection is UP you return false.... it's not correct !
-
spotdespot
- Trader
- Posts: 768
- Joined: Sun Jan 22, 2012 11:38 pm
Re: 10.2; the auto-trading EA is born.
WeeklyDirection is a string (text) <= doesn't work so well with text. != (not equal to) does.jjasper7 wrote:thank you, phil
re:trend trades ....
changing to ...Direction != up) return(false);
instead of
WeeklyDirection <= up)
is subtle - i do not see the difference! is '<=' not valid in Empty4 or something?
- alex_forex
- Trader
- Posts: 438
- Joined: Tue Nov 15, 2011 5:46 pm
- Location: F R A N C E
Re: 10.2; the auto-trading EA is born.
Hi all
Some bugs on Friday with V1N (I'll update the EA on my VPS over the Week End)
Broker Alpari UK
Regards
Alex
Some bugs on Friday with V1N (I'll update the EA on my VPS over the Week End)
Broker Alpari UK
Regards
Alex
You do not have the required permissions to view the files attached to this post.