here is what I understand of the code...
PHP Code:
//Trailing stop
if(TrailingStopMode && TrailingStop > 0) {
trailing stop mode is the bool variable which if true = 1 would satisfy the condition alone being greater than zero && (odd use of &&?) trailing stop is whatever external user value defined. so this line asks if the trailing stop is being used or not basically as determined by >0. I assume that if this condion returns false that it proceed to the 'else' and moves on...
no screaming so far...next
PHP Code:
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if the Bid (which is the current price to close a long position) minus the order open price...(which would scream 'profit' to me assuming the position is profitable) is > normalized trailing stop value.
so now we know the trailing stop is being used and that the price is currently higher than the trailing stop value to get an affirmative from this condition. I assume that if this condion returns false that it proceed to the 'else' and moves on...
next line..
PHP Code:
if(OrderStopLoss() < Bid - Point * TrailingStop) {
if Orderstoploss() ok that's a new one...returns the value of the open order stop loss...< current price to close a long position - normalized external user defined trailing stop value. This says to me that it should close if this returns true. I assume that if this condion returns false that it proceed to the 'else' and moves on...I admit it this one confuses me.

ok I get it...if the current stop loss value is less than what the current stop loss value shoud be now...
next
PHP Code:
OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen);
modifies the order to the current price to close a long position - the normalized trailing stop value...in other word the new stop loss level.
so I see one screamer there...you were right it did scream...
sooooo
PHP Code:
if(Bid - OrderOpenPrice() < OrderOpenPrice - Point * trigger1)
TrailingStop=T1; {
should be saying
if the current value of the long position is less than the normalized user defined trigger value....assign trailing stop this value
that should get it assigned at the trigger level...now to get the modification done and the code in the right place with the rest....
so, the lines say..
1- if we are using the trailing stop...
2- if the position's current value is higher than the trailing stop now...
3- if the current stop loss is less than the trailing stop parameter setting...
4- modify the order to the present level trailing setting.
well I definitely see that line two is where change is needed...
what i did so far assigns the trailing stop a new value that I can define at a certain level...
but what happens to the logic of the sequence when I do that...
so, IF the lines say..
1- if we are using the trailing stop...
2- if the position's current value is less than I will allow it to be without a trailing stop.../*higher than the trailing stop now*/...give the trailing stop this value...
3- if the current stop loss is less than the trailing stop parameter setting...
4- modify the order to the present level trailing setting.
see there's a problem with this..
2- if the position's current value is less than I will allow it to be without a trailing stop.../*higher than the trailing stop now*/...give the trailing stop this value...
that will trigger it the first time but that will not continue to trail once the price rises above me set level......will it??
what happens the second time it askes 'is the current value < I will allow it to be without a trailingstop? ...and it says NO! and proceeds to the else clause...
oy
I don't want to destroy the functionality of the trailing I just want to control where it engages in relation to the openorderprice() and how tightly it engages in stepping levels in relation to the openorderprice()...
I've got to think this thru so more...how do I put this in the loop without destroying the loop?