I got the error message "Stop price must be greater than 0".
What is wrong with my code? The current price is about 142.50 in edemo.
function preMain() {
setPriceStudy(false);
setStudyTitle("ATS_IBBridge_Testing");
setShowCursorLabel(false);
//setComputeOnClose();
}
function main( ) {
if ( getBarState() == BARSTATE_ALLBARS ) {
setStudyMax(100);
setStudyMin(0);
displayBuySellButtons();
}
}
function clickBuyMkt() {
buyMarket("SPY", 100);
sellStop("SPY", 100, formatPriceNumber(140.00)*1);
//sellStop("SPY", 100, formatPriceNumber(140.00));
}
function clickSellMkt() {
sellMarket("SPY", 100);
buyStop("SPY", 100, formatPriceNumber(145.00)*1);
}
What is wrong with my code? The current price is about 142.50 in edemo.
function preMain() {
setPriceStudy(false);
setStudyTitle("ATS_IBBridge_Testing");
setShowCursorLabel(false);
//setComputeOnClose();
}
function main( ) {
if ( getBarState() == BARSTATE_ALLBARS ) {
setStudyMax(100);
setStudyMin(0);
displayBuySellButtons();
}
}
function clickBuyMkt() {
buyMarket("SPY", 100);
sellStop("SPY", 100, formatPriceNumber(140.00)*1);
//sellStop("SPY", 100, formatPriceNumber(140.00));
}
function clickSellMkt() {
sellMarket("SPY", 100);
buyStop("SPY", 100, formatPriceNumber(145.00)*1);
}
Comment