New guy. Trying to understand about the variable Ask in SendOrder function.

 

Situation. You got your triger conditions saying trade just one last thing to check is the ask value or spread higher than normal?

Reason for asking

All of the code I have read uses the retrieved Ask value in the function Ordersend()

Task

Instead of using this ticks current Ask value would it be possible to use an average value of Ask obtained from some number of previously stored ticks?

The idea here is to get the orderprice to spread value you want rather than just accepting that this tick says now trade.

Result

Instead of using the current Ask value the EA would be placing an order that it calculates as being the right price for that moment in time.

Occurs to me that doing this short back averaging might stop the spike problem from being a surprise to the EA.

 
No. CB
 
cloudbreaker wrote >>
No. CB

Thanks CB!

Then why does the OrderSend function have this parameter? It would not work in a test or simulation as there is no pool of offers being accepted or rejected only the current recorded ticks ask value.

My current concept of money market: At any point in thine there are buyers and sellers (anybody used betfair?) you can either put into the pool an offer in the hope that it is matched and if not alter or cancel that offer as required. There must be hundreds of slightly different orders being recieved and matched or rejected by the broker moment by moment. The other way round would be that each tick is an offer that you personally can decided to take or reject. A spike is a big order being matched and absorbing lots of smaller packets of money. I suppose what I am asking is what process is happening when an order packet is recieved by the broker?

Then there is the order option "enable maximum deviation" when placing an order manually. This does not seem to be a parameter in the SendOrder function.

Also it seems just silly to be sending an order at an ask price you would manually reject. Manually you watch for a price that you can accept.

Baically the EA should 'see' a trigger order condition and wait in trigger period for acceptable or near acceptable Ask price but the EA is at the mercy of being fired with each tick.

Just putting thoughts down so that I can get a clear understanding of how this programing language works.

Would a static variable work with something like

(Been useing Delpi as programming language so syntax change over to C++ fouled up)

Pseudo Code wich this editor may alter onscreen editing layout.

If( Static Triger == true && Ask<=MaxAcceptPrice)

{//Then

OrderSend();

If( OrderMatched() )

{ // Then

Trigger=false

}; //end If( OrderMatched() )

};//end If( Static Triger == true && Ask<=MaxAcceptPrice)

If (NoOfTicksChecked>=50 | TrigerEndTime<Time()) {

Then Trigger=false

}endif//(NoOfTicksChecked | TrigerEndTime<Time())

 

Of course you can have your EA wait for an Ask/Bid price which (based upon your criteria) is acceptable before placing the order.

Then you call OrderSend() supplying the price (Ask for a BUY order, Bid for a Sell order).

The MT4 CLIENT will then check and either submit the order (if the price is valid) or return an "Invalid Price" error.

Once the order is submitted, then the MT4 SERVER checks the price you have asked for and if it falls more than your Slippage away from the current price, then it will return a "Requote" error to you.


CB

 

There may be a way for doing what you want. You determine the price you want to trade, then you place a STOP or LIMIT order for that price.

If u are also a "new guy" in trading, let me recommend you should open an account in a broker that provides micro lots.

Cheers.

AM.

 

Ok, my thanks to you both.

Have a lot more reading to do.

Have two accounts already abstract_mind - both enabled for microlots.

Reason: